+1 vote
16 views
1) Time complexity to construct a Binary tree when inorder and preorder/postorder traversal of the tree is given.

a) if inorder sorted

b) if inorder is not sorted.

2) If construct Binary tree when pre-order and postorder to the tree is given.

.....…

1 a) O( nlogn)

1 b) O(nlogn)

2) O(2^n)

Also shouldn’t (a) and (b) be $n^2$? Give your algorithm please.