Computer Science EngineeringModerate
In a max-heap, the largest element is always located at
- A. a leaf node
- B. the leftmost leaf
- C. the middle of the array
- D. the root
Correct answer: D. the root
The max-heap property makes every parent at least as large as its children, so the root is the maximum.
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 simple undirected graph has 10 vertices and exactly 3 connected components. What is the maximum possible number of edges?
- How many distinct spanning trees does the complete graph K4 have?
- The best-case running time of insertion sort (already sorted input) is
- The recurrence T(n) = T(sqrt(n)) + 1 has the solution
- Prim's algorithm on a graph stored as an adjacency matrix with a simple array for minimum selection runs in
- The postfix form of the infix expression a + b c - d is