Assuming they have just given the wrong diagram.
The answer should be 40.
If the above-given graph is indeed a heap, allocating 10 to root’s ie 12’s left child, we will have 3 “linear”, spaces on RHS and 2 spaces on LHS with 5 remaining vertices. Selecting 3 vertices from 5 for RHS, and due to being linearly ordered, which can be only done in 1 * 5C3 ways, the remaining 2 can be allocated in 2 ways, with a total of 2* 5C3 = 20.
> Have I misinterpreted the question?
Possibly, but in the real GATE exam, I am sure it will be mentioned clearly what the “problem’s” definition of a heap is.