Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning. Rick Cook

Heap sort

Language Java | Level Intermediate | Category Data structure | September 9, 2015 9:47 am


Data structure Description

Heap sort is a comparison-based sorting algorithm. It divides the input into a sorted and an unsorted region. It iteratively shrinks the unsorted region by extracting the largest element and moving that to the sorted region.

Write a program to implement the heapsort


Output

   					 

Before Sorting: 45 45 9 89 34 
After Sorting: 9 34 45 45 89

				    

Comments


No comments available!

Please login to add comments.