The problem. Sort an array of integers nums in ascending order, in place, in O(n log n) time — using a heap.
nums = [5, 2, 9, 1, 6, 3] -> [1, 2, 3, 5, 6, 9]
nums = [3, 3, 1] -> [1, 3, 3]
nums = [-2, 0, -5] -> [-5, -2, 0]Free account
Sign up to read the rest of this lesson: 7 more sections, 2 drawings, a dry-run simulator and code in JavaScript, Python, Java and C++.
Still to come