Fibonacci Heap – Deletion, Extract min and Decrease key
Fibonacci Heap – Deletion, Extract min and Decrease key In the last post, we discussed Insertion and Union of Fibonacci Heaps. In this post, we will discuss Extract_min(), Decrease_key() and Deletion() operations on Fibonacci heap. Prerequisites: Fibonacci Heap (Introduction) Fibonacci Heap – Insertion and Union Extract_min(): We create a function for deleting the minimum node and setting the min pointer to the minimum value in the remaining heap. The following algorithm is followed: Delete the min node. Set head to the next min node and add all the tree of the deleted node in root list. Create an array of degree pointers of the size of the deleted node. Set degree pointer to current node. Move to the next node. If degrees are different then set degree pointer to next node. If degrees are same then join the Fibonacci trees by union operation. Repeat steps 4 and 5 until the heap is completed. Example: Decrease_key(): To decrease the value of any element in