• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
July 18, 2024 |10.6K Views

Heap Sort

  Share  2 Likes
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/