Heap Sort

easy
1. You will be given an array of size N 2. You need to sort this array using heap sort, write sort and heapify functions 3. Input and output is handled for you 4. It is a functional problem ,please do not modify main()

Input Format

Input is handled for you.

Output Format

Output is handled for you.

Constraints

1 <= N <= 106
 1 <= arr[i] <= 106

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
8
18 12 7 14 6 3 19 16
Output
3 6 7 12 14 16 18 19
Previous
Find Kth Smallest Pair Distance
Next
Kth Element In Matrix

Related Questions