Just remember: you’re not a ‘dummy,’ no matter what those computer books claim. The real dummies are the people who–though technically expert–couldn’t design hardware and software that’s usable by normal consumers if their lives depended upon it. Walter Mossberg

Heap sort

Language Java | Level Intermediate | Category Algorithms | August 2, 2015 9:01 pm


Algorithm Problem Description

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

Heap sort is not stable sorting. A heap sort is especially efficient for data that is already stored in a binary tree. Heap sort does not take any extra space.

Write a program to implement heap sort.

Output

          	        
          	        

Unsorted array before sorting: [12, 34, 56, 23, 45, 78, 99]
Sorted array After Heap sorting: [12, 23, 34, 45, 56, 78, 99]

          	        
          	        				    


Comments



Please login to add comments.