heapq
Python standard library for [binary heap
Can add values, get minimum values, and remove values data structure.
Arbitrary values cannot be deleted, but the technique of skipping readings increases the range of applications.
heapq --- heapq algorithm - Python 3.8.3 documentation
heap queue priority queue Priority Queue
https://github.com/python/cpython/blob/master/Lib/heapq.py
technique
A value is added or deleted to a set. I want to get the smallest value.
M numbers move through a set of N numbers. We want to get the smallest element of the set
N values are updated, I want to know the minimum value.
I want to update the Kth value of the heap.
median
Getting the Best K
---
This page is auto-translated from /nishio/heapq using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.