hint
:
A binary heap has a predetermined number of nodes and a well-defined structure (full tree)
Think of this problem recursively.
"Choose" which of the numbers other than the roots goes into the left subtree, and from the right - and recursively call on the subtrees.
f(1) = 1
The question is marked as homework, so I leave the exact numbers for the general case to you.
source share