Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on What's New in Python 3.11?. Parent comment
For dict/set hash lookup, O(1):
x in s
(i:=bisect.bisect_left(a, x)) < len(a) and a[i] == x
There are no comments on this comment yet.
For dict/set hash lookup, O(1):
For binary search on a sorted python list, it takes a standard library import (bisect), and the containment test is: