Note: The height of a tree with a single node is .
View worked solution
Answer: 64
A binary search tree (BST) with nodes has a height of if and only if it is a skewed binary tree (a chain where every internal node has exactly one child).
To construct such a tree through sequential insertions:
- The first inserted element (the root) must be either the minimum or the maximum of the elements. This ensures all remaining elements go to one side (either entirely to the left or entirely to the right subtree). Thus, there are choices.
- The second inserted element must be either the minimum or the maximum of the remaining elements. This gives choices.
- This pattern continues for each subsequent insertion. For the -th insertion (where ), we have exactly choices (the minimum or the maximum of the remaining elements).
- For the last (-th) element, only choice remains.
Therefore, the total number of valid insertion sequences is:
Free practice · Your answers on this page are not saved.
