Answer to Question #198480 in Python for MongoMEME

Question #198480

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.


1
Expert's answer
2021-05-26T17:10:14-0400
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"])

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS