retagged by
1,371 views

3 Answers

4 votes
4 votes

Taking the given nodes as level order traversal, we can build the following binary tree

Now the max heap property is failing on vertices $15$ and $100$

After swapping, tree is 

Now the max heap property is failing on vertices $50$ and $100$

After swapping, tree is 

Now the max heap property is failing on vertices $89$ and $100$

After swapping, tree is 

The above tree is the final max heap binary tree. 

Minimum number of interchanges are $3$

Correct answer:  $A$

edited by
1 votes
1 votes

1st swap is: 100 and 15
2nd swap is: 100 and 50
3rd swap is: 100 and 89

1 votes
1 votes
  1. CREATE BINARY TREE 
  2. STEP 1 :- EXCHANGE 100 AND 15
  3. STEP 2 :- EXCHANGE 100 AND 50
  4. STEP 3 :- EXCHANGE 100 AND 89
  5. MAX HEAP IS COMPLETED ANSWER IS 3
Answer:

Related questions

1 votes
1 votes
3 answers
1
Arjun asked Dec 7, 2018
1,257 views
The smallest element that can be found in time ____ in a binary max heap.$O(n \log n)$$O( \log n)$$O(n)$$O(n^2)$
5 votes
5 votes
5 answers
2
Arjun asked Dec 7, 2018
2,065 views
______ to evaluate an expression without any embedded function calls.Two stacks are requiredone stack is neededThree stacks are requiredMore than three stacks are require...
1 votes
1 votes
2 answers
3
Arjun asked Dec 7, 2018
3,415 views
For a given hash table $T$ with $10$ slots that stores $1000$ elements, the load factor $\alpha$ for $T$ is$100$$0.01$$200$$1.05$
1 votes
1 votes
1 answer
4
Arjun asked Dec 7, 2018
4,247 views
____ is the worst-case time complexity for all operations (i.e.,) search, update and delete) in a general Binary Search tree$O(n)$$O(n \log n)$$O( \log n)$ for search and...