• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
June 10, 2022 |3.7K Views
Heap Sort
  Share   Like
Description
Discussion

Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to selection sort where we first find the minimum element and place the minimum element at the beginning. We repeat the same process for the remaining elements.


Let us first define a Complete Binary Tree. A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible (Source Wikipedia)


A Binary Heap is a Complete Binary Tree where items are stored in a special order such that the value in a parent node is greater(or smaller) than the values in its two children nodes. The former is called max heap and the latter is called min-heap. The heap can be represented by a binary tree or array.

 

Heap Sort : https://www.geeksforgeeks.org/heap-sort/

Read More