ISRO Computer Science (CSE) 2026 - Question 64

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2026

Topic: Data Structures / Heaps

Given an array representing a Min-Heap: [5, 9, 10, 15, 12, 17]. After inserting the value 7 into the heap, what is the array representation of the updated Min-Heap?

  • A. [5, 7, 9, 10, 12, 15, 17]
  • B. [5, 7, 9, 15, 12, 10, 17]
  • C. [5, 9, 7, 15, 12, 17, 10]
  • D. [5, 9, 15, 7, 12, 17, 10]

Answer: C. [5, 9, 7, 15, 12, 17, 10]

Explanation: To insert 7 into the min-heap, first place it at the very end of the array to maintain the complete binary tree property: `[5, 9, 10, 15, 12, 17, 7]`. The new element 7 is at index 6. We then "heapify up". The parent of index 6 is $(6-1)/2 = 2$. The value at index 2 is 10. Since $7 < 10$, they swap. The array becomes `[5, 9, 7, 15, 12, 17, 10]`. The element 7 is now at index 2. Its new parent is $(2-1)/2 = 0$. The value at index 0 is 5. Since $7 > 5$, the heap property is satisfied, and the process stops.

| | All questions of ISRO Computer Science (CSE) 2026