replacing in heap the heapreplace function always removes the smallest element of the heap and inserts the new incoming element at some place not fixed by any order import heapq [ , , , , , create the heap heapq heapify(hprint(hreplace an element heapq heapreplace( , print( [ [