The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
94 views

The number of distinct min heap are possible with keys 1, 2, 3, 4, 5 are ________.

I know, there are variance of this question for Max heap and even for Min heap, the answer won't change, but I just wanna know if my technique is right or not. 

=============================================================================================

 

 

Since it's a Min heap, the minimum value will be at root. 

This will be the min heap as  

                                 o   -------> root will be chosen in 1 way
                                / \
                               o   o 
                              / \ 
                             o  o

-> Left sub tree will be **4C3*1*2** way as again root will get min value and left and right child can get any value. 

-> Lastly the right sub tree => 1C1 = 1 

Totally - 1*4C3*1*2*1 = 8. Is this approach correct?

asked in DS by Loyal (9.4k points)
edited by | 94 views
+1
shouldn't be left sub tree 4C3*1*2?
0
Yes, indeed, wrongly typed. It's 4C3*1*2. Then is it correct?
0
yes then correct.
+1
Thanks Gupta Ji! :)

Please log in or register to answer this question.

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

47,005 questions
51,325 answers
177,502 comments
66,668 users