• retagged by
9,702 views

3 Answers

Best answer
41 41 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
14 14 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 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:
Position:
Show:

Related questions

32 32 votes
5 answers 5 answers
13.8k
13.8k views
Kathleen asked Sep 18, 2014
13,777 views
Given the following input $(4322, 1334, 1471, 9679, 1989, 6171, 6173, 4199)$ and the hash function $x$ mod $10$, which of the following statements are true?$9679, 1989, 4...
31 31 votes
3 answers 3 answers
10.3k
10.3k views
Kathleen asked Sep 18, 2014
10,317 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
27 27 votes
4 answers 4 answers
11.1k
11.1k views
Kathleen asked Sep 18, 2014
11,089 views
The best data structure to check whether an arithmetic expression has balanced parentheses is aqueuestacktreelist
39 39 votes
6 answers 6 answers
29.7k
29.7k views
Kathleen asked Sep 18, 2014
29,746 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...