View worked solution
Answer: 80
A min-heap containing distinct elements is a complete binary tree where the root always contains the minimum element. The remaining elements are distributed between the left subtree of size and the right subtree of size ().
The number of ways to construct a min-heap of size , denoted as , is given by the recurrence relation:
For , a complete binary tree has a left subtree of size and a right subtree of size .
- Calculate : For a heap of size 3, the left and right subtrees each have size 1 ().
- Calculate : Using :
Thus, the number of possible min-heaps is 80.
Free practice · Your answers on this page are not saved.
