Question 91
What is the minimum number of nodes in an AVL tree of height 5, using N(0)=1 and N(1)=2?
N2=4, N3=7, N4=12, N5=20.
What is the minimum number of nodes in an AVL tree of height 5, using N(0)=1 and N(1)=2?
N2=4, N3=7, N4=12, N5=20.
How many distinct BSTs can be formed using 5 distinct keys?
The number is Catalan C5 = 42.
A max-heap has 31 elements. What is the maximum possible height of the heap (root at height 0)?
A complete binary tree with 31 nodes has height floor(log2 31)=4.
A binary tree has 18 internal nodes and is full. How many total nodes does it have?
For a full binary tree, total nodes = 2I+1 = 37.
In a 0-based heap with 20 elements, what is the index of the first leaf node?
The first leaf index is floor(n/2)=10.