Practical - 14: Write A Program To Implement Heap Sort
Practical - 14: Write A Program To Implement Heap Sort
Practical - 14: Write A Program To Implement Heap Sort
Practical - 14
Write a program to implement Heap Sort.
Heap Sort
Input :
#include <stdio.h>
void main()
{
int heap[10], no, i, j, c, root, temp;
Output :
Enter no of elements :5
Enter the nos : 11
12
13
14
15
Heap array : 15 14 12 11 13
The sorted array is : 11 12 13 14 15
Complexity :
Best case = Avg case = Worst case = O(n logn)