Heapify an array into a max-heap
Akuna CapitalSoftware Engineer · Online AssessmentLast updated
This question evaluates understanding of heap data structures and the in-place bottom-up heapify algorithm for building a max-heap on a 0-indexed array, testing skills in array manipulation, heap invariants, and algorithmic reasoning.
Given the array [6, 15, 2, 4, 3, 8, 19], apply heapify to build a max-heap using the standard in-place bottom-up method with a 0-indexed array representation. What is the final array after heap construction? Show key steps or justify your result.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.