Heap Sort Problem Statement
Your task is to sort an array of integers in non-decreasing order using the Heap Sort algorithm.
Input:
The first line contains an integer 'T' denoting the number of test cases.
Each test case consists of two lines:
- The first line contains a single integer 'N', the number of elements in the array.
- The second line contains 'N' space-separated integers, the elements of the array.
Output:
For each test case, output 'N' space-separated integers sorted in non-decreasing order.
Each test case's output should be on a separate line.
Example:
Input:
2
4
4 10 3 5
3
9 7 6
Output:
3 4 5 10
6 7 9
Constraints:
- 1 <= T <= 10
- 1 <= N <= 105
- -109 <= ARR[i] <= 109
Note:
Implement the function; you do not need to handle any printing as it has been managed externally.
Be the first one to answer
Add answer anonymously...
Popular interview questions of Software Engineer
Top HR questions asked in RadiSys Software Engineer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app