Google Interview Question
- 1of 3 votes
Given an inorder traversal only for a binary tree (not necessarily a
BST), give a pseudo code to generate all possible binary trees for
this traversal sequence.
Firstly, how many binary trees can be generated given an in-order
traversal? I know that given 'n' nodes, number of BTs possible is
(2^n)-n. But if we are given a specific in-order sequence, can we cut
down on this number?
Country: United States