Answers for "delete an element from a given position in min heap"

0

delete an element from a given position in min heap

1, Delete a node from the array 
       (this creates a "hole" and the tree is no longer "complete")

    2. Replace the deletion node
       with the "fartest right node" on the lowest level
       of the Binary Tree
       (This step makes the tree into a "complete binary tree")

    3. Heapify (fix the heap):

         if ( value in replacement node < its parent node )
            Filter the replacement node UP the binary tree
         else
	    Filter the replacement node DOWN the binary tree
Posted by: Guest on May-17-2020

Python Answers by Framework

Browse Popular Code Answers by Language