DAA Module-3-2
DAA Module-3-2
0 1 2 3 4 5
DAA Lab PRG-5
Transform and Conquer
Approach: Heaps and Heap Sort
Heap Sort Algorithm
Heap sort processes the elements by creating the min-heap or max-heap using
the elements of the given array. Min-heap or max-heap represents the
ordering of array in which the root element represents the minimum or
maximum element of the array.
Before knowing more about the heap sort, let's first see a brief description
of Heap.
What is a heap?-
A heap is a complete binary tree
The binary tree is a tree in which the node can have the utmost two children.
A complete binary tree is a binary tree in which all the levels except the last level,
i.e., leaf node, should be completely filled, and all the nodes should be left-justified.
4 9