827 views
2 2 votes
Is it possible to construct multiple binary from given preorder and postorder?

1 Answer

Best answer
4 4 votes

Before some days I also had same doubt Yes multiple binary trees possible 

With preorder and postorder, we can't create a unique binary tree. There will be ambiguity and multiple trees can exist.

For example,

 


• selected by
Position:
Show:

Related questions

10 10 votes
1 1 answer
561
561 views
6 6 votes
1 1 answer
398
398 views
GO Classes asked Jul 28
398 views
For the keys:$47, 61, 36, 52, 56, 33, 92$consider the hash function:$h(k) = ((10k + 4) \bmod c) \bmod 7$Find the smallest positive integer $c$ such that no collisions occ...
4 4 votes
1 1 answer
300
300 views
GO Classes asked Jul 28
300 views
Suppose vector $A$ is a min-heap:$A = [2, 4, 3, 6, 7, 3, 5, 8, 9]$After calling $\texttt{Push(1)}$, what is the final heap array?$[1, 2, 3, 6, 4, 3, 5, 8, 9, 7]$ $[1, 4, ...
10 10 votes
1 1 answer
353
353 views
GO Classes asked Jul 28
353 views
A binary tree has:$1000$ nodes in the left subtree $100$ nodes in the right subtreeHow many nodes are processed before the root in preorder, inorder, and postorder traver...