|Total Page :||362 Pages|
|PDF Size :||7.1 MB|
|PDF Link :||Available|
Putting all the functions defined together and inheriting Heap’s functions, the complete implementation and example of min-heap is shown next. The add and poll functions were added.
add simply adds a new element to the heap, but bubble up ensures that this element in the min-heap satisfies the order. poll removes the minimum element (the root) from the heap and calls the bubble down to keep the min-heap order.
Know more about our initiative