recategorized by
499 views
3 votes
3 votes

PLZ EXPLAIN?

recategorized by

2 Answers

Best answer
4 votes
4 votes

Given Elements : 12,10,8,5,3,2,1,7,9

1) Maximum of all these will be root i.e. Root = 12 ---->1 way --->(1)

2) Remaining : 8 elements

Out of 8 choose 5 for left subtree in 8C5 ways and 3 for right subtree in 3C3 ways. --->(2)

3)Left Subtree :

Out of 5, maximum element is the root.

Out of remaining four , choose 3 for left subtree in 4C3 ways , Out of 3 elements chosen, max is root and rest 2 can be in any of the 2 leaf nodes.

#Heaps possible in Left Subtree= 4C3 * 2 --->(3)

3)Right Subtree :

Out of 3, maximum is root.

Remaining 2 elements can be arranged in 2 leaves in 2 ways.

#Heaps possible in Right Subtree=  2 --->(4)

Hence From (1) to (4) , Total # heaps possible = 1 * ( 8C5 * 4C3 *2 )  * (3C3 * 2 )

=56 * 4 * 2 * 2 =896 (ANS)

selected by
Answer:

Related questions

0 votes
0 votes
1 answer
1
1 votes
1 votes
3 answers
2
Aboveallplayer asked Dec 4, 2016
657 views
A mean -heap having 1024 elements with the key ranging from 0 to 1023 ,stored in array of 1024 indices the maxmimum difference between keys of all elements that can be st...
1 votes
1 votes
0 answers
3
6 votes
6 votes
2 answers
4
Vishal Goyal asked Dec 6, 2016
759 views
The number of min heap trees are possible with 15 elements such that every leaf node must be greater than all non-leaf nodes of the tree are ________.