Heap
Heap Heap is a special case of balanced binary tree data structure where the root-node key is compared with its children and arranged accordingly. Min-Heap Where the value of the root node is less than or equal to either of its children. Min-heap construction Algorithm 1. Create a new node at the end of the heap 2. Assign new value to the node. 3. Compare the value of this child node with its parent 4. if value of parents is more than child, then swap them 5. repeat step 3 & 4 until heap property holds Min-heap deletetion 1. Remove root node 2. Move last element of the last root to root 3. Compare the value of this child node with its parent 4. If the value is more than child, then swap them. 5. Repeat step 3 & 4 until heap property holds Max-Heap Where the value of the root node is greater than or equal to either of its children. Max-heap construction Algorithm 1. Create a new node at the end of the heap 2. Assign new value to the node. 3. Compar...