browse/
2 results
computer-science/binary-search-how-to-find-one-number-in-a-million-with-20-guesses.md
Binary search: how to find one number in a million with 20 guesses
Guessing a number between 1 and 1,000,000 sounds like it could take a million tries. With binary search it takes at most 20. Step through a…
computer-science/hash-tables-how-python-finds-a-key-without-searching-for-it.md
Hash tables: how Python finds a key without searching for it
You type `ages["cat"]` and Python answers instantly, even with a million entries. It does not search. It calculates where "cat" must be…