The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
113 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 (7.9k points)
edited by | 113 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
49,783 questions
54,511 answers
188,329 comments
75,112 users