Computer Science EngineeringHard
How many leaf nodes does a binary heap stored in an array of 15 elements have?
- A. 4
- B. 6
- C. 7
- D. 8
Correct answer: D. 8
Indices 8 to 15 are leaves, i.e. ceil(n/2) = 8 leaves.
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
- A table of size 7 uses h(k) = k mod 7 with linear probing. After inserting 15, 22, 8 and 1 in that order, at which index does key 1 reside?
- The Bellman-Ford single-source shortest path algorithm has running time
- What is the Theta bound of: for(i=1;i<=n;i++) for(j=i;j<=n;j+=i) count++;
- The recurrence T(n) = 4T(n/2) + n^2 has solution
- The time complexity of topological sorting of a DAG with V vertices and E edges using DFS is
- Which of the following standard sorting algorithms is stable?