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.

## What previously seen sorting algorithm is heap sort based on?

A heap sort is a sorting algorithm based on the binary heap data structure. As explained in a previous post, a binary tree is a tree data structure where each element has at most 2 children.

## What is the basic concept of heap tree?

A heap is a tree-based data structure that allows access to the minimum and maximum element in the tree in constant time. The constant time taken is Big O(1). This is regardless of the data stored in the heap. There are two types of heaps: Min-heap and Max-heap.

## Why is heap sort on log n?

One clever aspect of the data structure is that it resides inside the array to be sorted. We argued that the basic heap operation of Heapify runs in O(log n) time, because the heap has O(log n) levels, and the element being sifted moves down one level of the tree after a constant amount of work.

## WHAT ARE THE HEAP applications?

Heap Implemented priority queues are used in Graph algorithms like Prims Algorithm and Dijkstras algorithm. Order statistics: The Heap data structure can be used to efficiently find the kth smallest (or largest) element in an array.