Which data structure does Python’s `heapq` module implement?

Python Professional Hard

Python Professional — Hard

Which data structure does Python’s `heapq` module implement?

Key points

  • Min-heap in `heapq` has the smallest element at the root.
  • Max-heap would have the largest element at the root.
  • Balanced BST and Red-black tree are not implemented by Python's `heapq` module.

Ready to go further?

Related questions