leetcode_gym/_code/heap/heaptest.py
2026-08-25 19:14:07 -06:00

14 lines
234 B
Python

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))