2026-08-07 09:14:45Niklas Polke:
Update Heapq - info about binary tree
python/heapq.md ..
@@ 1,5 1,5 @@
# Heapq
-
Python’s heapq module implements a min-heap using a regular list. The smallest element is always stored at index 0.
+
Python’s heapq module implements a min-heap using a regular list. The smallest element is always stored at index 0. The structure of the heap is a binary tree and the parent node is always smaller than the child node.
:::info
My usecase was to have a performant collection with a maximum size that removes the worst results to focus on the best.