106 Construct Binary Tree from Inorder and Postorder Traversal
106. Construct Binary Tree from Inorder and Postorder Traversal
1. Question
Given inorder and postorder traversal of a tree, construct the binary tree.
2. Implementation
(1) Recursion
3. Time & Space Complexity
Recursion: 时间复杂度O(n^2),如果tree是skewed, 当tree是balanced,时间复杂度是O(nlogn),空间复杂度是O(n),因为map
Previous105 Construct Binary Tree from Preorder and Inorder TraversalNext606 Construct String from Binary Tree
Last updated