edited by
585 views
1 votes
1 votes

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?

edited by

1 Answer

Related questions

0 votes
0 votes
0 answers
1
iarnav asked Jun 24, 2018
254 views
The number of possible min-heaps containing each value from {1,1,1,1,1,1,1} exactly once is _______This is a variance of Gate 2018 question and how will we deal if all va...
2 votes
2 votes
1 answer
2
Thor-o-s asked Sep 1, 2022
391 views
Can anyone please explain how to find “ i “ smallest elements from an array whose elements are distinctPlease use max heap to explain the working input : n distinct e...
0 votes
0 votes
1 answer
3
saurav raghaw asked Dec 22, 2018
674 views
The time complexity of the most efficient algorithm to determine whether an arbitrary array of size ‘n’, is min-heap or not?(A) O(log n)(B) O(n)(C) O(n logn)(D) O(1)
1 votes
1 votes
1 answer
4
gmrishikumar asked Dec 1, 2018
2,248 views
What is the time complexity to find the Kth largest element in a Min-Heap? Or equivalently, What is the time complexity to find Kth smallest element in Max-Heap?