pocketpy/tests/70_heapq.py
2023-03-16 23:51:20 +08:00

9 lines
180 B
Python

from heapq import heapify, heappop, heappush
from random import randint
a = [randint(0, 100) for i in range(1000)]
b = sorted(a)
heapify(a)
for x in b:
assert heappop(a) == x