How do I implement minimum heap on date and time, e.g. 23/7/2021 23:45, 24/5/2021 22:10, 20/5/2021 20:00. To implement minimum heap on the example.
from heapq import *
def HeapSort(i):
hp = []
for v in i:
heappush(hp, v)
return [heappop(hp) for j in range(len(hp))]
HeapSort(["23/7/2021 23:45","24/5/2021 22:10","20/5/2021 20:00"])
Comments
Leave a comment