Heap
Heap
Algorithm
23AID204
Advanced Data Structures & Algorithm Analysis
ULLAS S.
Assistant Professor
AMRITA SCHOOL OF COMPUTING
BENGALURU
Heap
• A heap is a complete binary tree, and the binary tree is a tree in which
the node can have 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
• There are two types of the heap:
• Min Heap: The value of the parent node should be less than or equal to either
of its children
• Max heap: The value of the parent node is greater than or equal to its children.
11 33 44 66
{ if(A[parent]<A[i])
while(i>1) else
{ {
• https://www.javatpoint.com/heap-data-structure