edited by
13,510 views

3 Answers

Best answer
32 votes
32 votes

"The minimum number of interchanges needed to convert the array
$89, 19, 40, 17, 12, 10, 2, 5, 7, 11, 6, 9, 70$
into a heap with the maximum element at the root node is:"

This is the correction.

Answer: C.

Only element $70$ violates the rule. Hence, it must be shifted to its proper position.
Step1: $swap(10, 70)$
Step2: $swap(40, 70)$
Hence, only $2$ interchanges are required.

edited by
13 votes
13 votes

2 interchanging is required.

1 votes
1 votes

To get minimum number of exchanges ,just apply heapify function on each of the non leaf node starting from the last non leaf node and proceeding up the tree towards the root.In doing so,we encounter two interchanges 

Swap(70,10)

Swap(40,70)

Therefore,minimum number of interchanges needed are 2. 

 

 

Answer:

Related questions

26 votes
26 votes
5 answers
1
Kathleen asked Oct 9, 2014
30,460 views
A binary search tree is generated by inserting in order the following integers:$$50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24$$The number of nodes in the left subtree and ...
21 votes
21 votes
3 answers
2
Kathleen asked Oct 9, 2014
4,311 views
Which of the following sequences denotes the post order traversal sequence of the below tree?$f\; e\; g\; c\; d\; b\; a$$g\; c\; b\; d\; a\; f\; e$$g\; c\; d\; b\; f\; e\...
19 votes
19 votes
4 answers
4
Kathleen asked Oct 9, 2014
9,047 views
What is the equivalent Boolean expression in product-of-sums form for the Karnaugh map given in Fig $B\overline{D} + \overline{B}D$$(B + \overline{C} +D) (\overline{B} + ...