leetcode_gym/_code/heap/heaptest.py

14 lines
234 B
Python
Raw Permalink Normal View History

import heapq
li = [5, 7, 9, 1, 3]
heapq.heapify(li)
# printing created heap
print ("The created heap is : ",end="")
print (list(li))
heapq.heappush(li,4)
print ("The modified heap after push is : ",end="")
print (list(li))