retagged by
5,586 views

3 Answers

Best answer
28 votes
28 votes

The answer is option A.

Just keep inserting elements making sure resulting Tree is nearly Complete. (Heap Property) .

While inserting any node, if you find that  Value of New Node $>$ Value of its parent, bubble it up to keep Max heap property

edited by
10 votes
10 votes
Insert each node as the left most leaf and check if it is less than the parent or not, if not then swap it with the parent

   32

   32
   /
15

   32
   /  \
15  20

Now 30 cannot be inserted as 15's child, so it will be in 15's place with 15 as it's child

    32
    /  \
 30  20
  /
15

     32
     /  \
  30  20
  /  \
15  12

25 cannot be inserted as 20's child, so it will be in place of 20, with 20 as it's child

        32
        /  \
     30   25
    /  \      /
 15  12  20

        32
        /   \
     30    25
    /  \      /  \
 15  12  20  16
6 votes
6 votes
Option a is correct just try to insert an element and shift whenever necessary Here shift operation is performed when 30 and 25 is inserted
Answer:

Related questions

19 votes
19 votes
3 answers
2
Kathleen asked Sep 18, 2014
6,379 views
Level order traversal of a rooted tree can be done by starting from the root and performingpreorder traversalin-order traversaldepth first searchbreadth first search
19 votes
19 votes
4 answers
3
Kathleen asked Sep 18, 2014
6,938 views
The best data structure to check whether an arithmetic expression has balanced parentheses is aqueuestacktreelist
27 votes
27 votes
6 answers
4
Kathleen asked Sep 18, 2014
22,413 views
The following numbers are inserted into an empty binary search tree in the given order: $10, 1, 3, 5, 15, 12, 16$. What is the height of the binary search tree (the heigh...