Skip to content

Latest commit

 

History

History
23 lines (19 loc) · 1.21 KB

HEAP.md

File metadata and controls

23 lines (19 loc) · 1.21 KB

Main

Heap Data Structure


A Heap is a special Tree-based data structure in which the tree is a complete binary tree.

Heap Heap

  • Max Heap: In a max heap, the root node must be the largest among all other nodes in the heap, and every node must be greater than or equal to its children.
  • Min Heap: In a min heap, the root node must be the smallest among all other nodes in the heap, and every node must be less than or equal to its children.

Heap

Heapify : It is a process in which an unordered binary tree is transformed into a valid heap by adjusting/pushing the nodes upwards or downwards in the tree to satisfy the heap property, either the max-heap property (where the parent node is greater than or equal to its children) or the min-heap property (where the parent node is less than or equal to its children).