Experiment No - Write A Program To Implement Heap Sort
The document describes implementing heap sort by:
1) Defining functions to swap elements, create a max heap by recursively placing elements in the correct position, and delete the max element from the heap by swapping with the last element and adjusting positions.
2) Calling the create heap function in a loop to build the max heap from an input array, then calling delete heap in a loop to extract elements in sorted order.
3) Printing the sorted array.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
24 views3 pages
Experiment No - Write A Program To Implement Heap Sort
The document describes implementing heap sort by:
1) Defining functions to swap elements, create a max heap by recursively placing elements in the correct position, and delete the max element from the heap by swapping with the last element and adjusting positions.
2) Calling the create heap function in a loop to build the max heap from an input array, then calling delete heap in a loop to extract elements in sorted order.
3) Printing the sorted array.