Computer Science EngineeringHardISRO SC (CS)
The max-heap [95, 84, 54, 64, 16, 43, 42, 24] undergoes one extract-max (last element moved to the root, then sifted down). The resulting heap array is:
- A. [84, 64, 54, 24, 16, 43, 42]
- B. [84, 54, 64, 16, 43, 42, 24]
- C. [84, 64, 54, 43, 42, 24, 16]
- D. [24, 84, 54, 64, 16, 43, 42]
Correct answer: A. [84, 64, 54, 24, 16, 43, 42]
Remove 95, place 24 at the root and sift down: [84, 64, 54, 24, 16, 43, 42].
Practise more Algorithms, Data Structures & Programming (ISRO CS) questionsAlgorithms, Data Structures & Programming (ISRO CS): notes and key points
More Algorithms, Data Structures & Programming (ISRO CS) questions
- Insertion sort (scanning the sorted prefix from right to left, stopping at the first element not greater than the key) is run on [9, 7…
- Consider the following C fragment. int c=0; int x=40; while(x>0){ for(int j=0;j<x;j++) c++; x/=3; } What is c at the end? (integer division)
- Tower of Hanoi with 10 disks and three pegs needs the minimum number of moves equal to:
- Which data structure follows the Last-In-First-Out principle?
- The height (in edges) of a complete binary tree having n nodes is
- The time needed to build a binary heap from n arbitrary elements using bottom-up heapify is