• edited by
20,370 views

3 Answers

Best answer
40 40 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
27 27 votes

2 interchanging is required.

1 1 vote

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:
Position:
Show:

Related questions

36 36 votes
6 answers 6 answers
37.0k
37.0k views
Kathleen asked Oct 9, 2014
37,016 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 ...
27 27 votes
3 answers 3 answers
7.1k
7.1k views
Kathleen asked Oct 9, 2014
7,056 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\...
52 52 votes
7 answers 7 answers
24.9k
24.9k views
Kathleen asked Oct 9, 2014
24,880 views
Consider the following statements:First-in-first out types of computations are efficiently supported by STACKS.Implementing LISTS on linked lists is more efficient than i...
27 27 votes
7 answers 7 answers
14.5k
14.5k views
Kathleen asked Oct 9, 2014
14,482 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} + ...