Ejemplo n.º 1
0
# import random number generator
from random import randrange
# import heap class
from 10-min_heap import MinHeap 

# make an instance of MinHeap
min_heap = MinHeap()

# populate min_heap with descending numbers
descending_nums = [n for n in range(10001, 1, -1)]
print("ADDING!")
for el in descending_nums:
  min_heap.add(el)

print("REMOVING!")
# remove minimum until min_heap is empty
min_heap.retrieve_min()
Ejemplo n.º 2
0
# import heap class
from 03-min_heap import MinHeap 

min_heap = MinHeap()
print(min_heap.heap_list)

# testing out .add()
min_heap.add(42)
print(min_heap.heap_list)