computer-science/
Algorithms, data structures and the theory every language shares.
4 results
computer-science/breadth-first-search-how-a-maze-solver-finds-the-shortest-way-out.md
Breadth-first search: how a maze solver finds the shortest way out
How does a maze solver, or a map app, find the shortest route and not just any route? The answer is breadth-first search: explore every…
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…
computer-science/linear-vs-binary-search-why-30-guesses-can-beat-a-billion.md
Linear vs binary search: why 30 guesses can beat a billion
Need to find one item in a list? You can check every item in turn (linear search), or, if the list is sorted, look at the middle and throw…