from heapq import heapify, heappush, heappop

# Creating empty heap
heap = []
heapify(heap)

# Adding items to the heap using heappush function
heappush(heap, 10)
heappush(heap, 30)
heappush(heap, 20)
heappush(heap, 400)

# printing the value of minimum element
print("Head value of heap : " + str(heap[0]))

# printing the elements of the heap
print("The heap elements : ")
for i in heap:
    print(i, end=" ")
print("\n")

element = heappop(heap)

# printing the elements of the heap
print("The heap elements : ")
for i in heap:
    print(i, end=" ")
print("\n")
print("string Heap")
string_ = []
heapify(string_)

for ele in list("ABCDEAABAD"):
    heappush(string_, ele)


print(string_)

from heapq import heapify, heappush, heappop

# Creating empty heap
heap = []
heapify(heap)

# Adding items to the heap using heappush function
heappush(heap, 10)
heappush(heap, 30)
heappush(heap, 20)
heappush(heap, 400)

# printing the value of minimum element
print("Head value of heap : " + str(heap[0]))

# printing the elements of the heap
print("The heap elements : ")
for i in heap:
    print(i, end=" ")
print("\n")

element = heappop(heap)

# printing the elements of the heap
print("The heap elements : ")
for i in heap:
    print(i, end=" ")
print("\n")
print("string Heap")
string_ = []
heapify(string_)

for ele in list("ABCDEAABAD"):
    heappush(string_, ele)


print(string_)

# Creating empty heap # Adding items to the heap using heappush function # printing the value of minimum element # printing the elements of the heap # printing the elements of the heap