70_heapq.py 180 B

123456789
  1. from heapq import heapify, heappop, heappush
  2. from random import randint
  3. a = [randint(0, 100) for i in range(1000)]
  4. b = sorted(a)
  5. heapify(a)
  6. for x in b:
  7. assert heappop(a) == x