Given a pre-order sequence from a binary tree traversal, how many unique trees can be constructed? Give the recurrence relation. Eg. given the pre-order traversal sequence 1, 2 you can create 2 unique trees:
2 3 This leads to the obvious base cases: T(0) = 1 T(1) = 1 T(2) = 2 what is T(N), where N is the number of elements in the sequence? |