Question 67Asked in DSSSB TGT Computer Science (Technical), 7 Aug 2021, Shift 3

Consider the following arrays of elements 289, 219, 250, 217, 212, 215, 22, 25, 27, 211, 26, 29, 300. What is the minimum number of interchanges needed to…

Consider the following arrays of elements 289, 219, 250, 217, 212, 215, 22, 25, 27, 211, 26, 29, 300. What is the minimum number of interchanges needed to convert it into max-heap?
  1. A4
  2. B5
  3. C2
  4. D3
Show answerHide answer

Correct answer: (D) 3

Explanation

Bottom-up heapify: 215 swaps with 300, 250 swaps with 300, then 289 swaps with 300. No other node violates the heap, so 3 interchanges.

From DSSSB TGT Computer Science PYQ (Technical), 7 Aug 2021, Shift 3

This is question 67 of DSSSB TGT Computer Science PYQ (Technical), 7 Aug 2021, Shift 3. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.