Computer Science EngineeringVery hardISRO SC (CS)
The max-heap [92, 49, 62, 39, 40, 19, 28, 36, 38] undergoes one extract-max (last element moved to the root, then sifted down). The resulting heap array is:
- A. [49, 62, 39, 40, 19, 28, 36, 38]
- B. [62, 49, 38, 39, 40, 19, 28, 36]
- C. [62, 49, 40, 39, 38, 36, 28, 19]
- D. [38, 49, 62, 39, 40, 19, 28, 36]
Correct answer: B. [62, 49, 38, 39, 40, 19, 28, 36]
Remove 92, place 38 at the root and sift down: [62, 49, 38, 39, 40, 19, 28, 36].
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
- The worst-case number of key comparisons binary search makes on a sorted array of 100 elements (counting one three-way comparison per…
- Trace this C function. int f(int n){ if(n==0) return 1; return nf(n-1) - f(n/2); } (integer division) What does f(6) return?
- Using the Master theorem (extended form), the solution of T(n) = 27T(n/3) + n^3 is:
- Using the Master theorem (extended form), the solution of T(n) = 2T(n/3) + n is:
- Consider the following C fragment. int c=0; for(int i=200;i>=1;i/=2) for(int j=0;j<i;j++) c++; What is c at the end? (integer division)
- The worst-case number of key comparisons binary search makes on a sorted array of 127 elements (counting one three-way comparison per…