Heap sort

From Wiki :-)
Revision as of 07:27, 3 June 2018 by Savoundg (talk | contribs) (Created page with "Heap sort algorithm builds the max. heap using the elements to be sorted. In max. heap, any sub-tree root node is bigger than its children node. The algorithm swaps the root...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Heap sort algorithm builds the max. heap using the elements to be sorted.

In max. heap, any sub-tree root node is bigger than its children node.

The algorithm swaps the root node (bigger element) with the last node (smaller element) and remove the last node which is the bigger element, then it re-creates the max. heap. The algorithm applies in the same manner on the sub-tree.

Resources

https://www.youtube.com/watch?v=MtQL_ll5KhQ