Computer Science · Data Structures
For the heapify function on an array [1, 3, 2] with size n = 3 and starting index i = 0, what is the modified array content? def heapify(arr, n, i): largest = i l = 2 * i + 1 r = 2 * i + 2 if l arr[largest]: largest = l if r arr[largest]: largest = r if largest != i: arr[i], arr[largest] = arr[largest], arr[i] heapify(arr, n, largest)
- 1[3, 1, 2]✓
- 2[3, 2, 1]
- 3[1, 3, 2]
- 4[2, 3, 1]
Correct answer
[3, 1, 2]
Download Single Question PDF
Save this question and verified answer as a clean study sheet with live clickable link.
Share with Friends & Study Groups
Challenge your peer aspirants on WhatsApp or Telegram to solve this question!
Preparing for Computer Science?
Practice full-length mock tests with real exam timers, instant score analysis, and all-India ranking.
Want more practice questions on Data Structures?
Solve complete topic-wise tests with detailed solutions on GkGet.
Related Practice Questions
Recommended practice questions in Computer Science · Data Structures