Medium

Tree Construction

With unique keys, inorder plus preorder, or inorder plus postorder, determines the tree. The root comes from the preorder or postorder, and inorder splits the children.

Costs

CategoryAlgorithm
DifficultyMedium
Build with a hash map of inorder indexesO(n)
Inorder alonenot enough
Preorder alonenot enough

Questions

What is Tree Construction?

With unique keys, inorder plus preorder, or inorder plus postorder, determines the tree. The root comes from the preorder or postorder, and inorder splits the children.

Where do I practice it?

DSA Master keeps challenges and progress on the phone. This page is the idea and the costs.