computer-science/
Algorithms, data structures and the theory every language shares.
5 results
computer-science/merge-sort-how-splitting-a-list-in-half-again-and-again-sorts-it-with.md
Merge sort: how splitting a list in half again and again sorts it with far less work
How do you sort 10,000 numbers without making millions of comparisons? Merge sort never sorts a big pile. It splits the list until every…
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/what-is-an-algorithm-watch-two-recipes-race-to-sort-six-bars.md
What Is an Algorithm? Watch Two Recipes Race to Sort Six Bars
An algorithm is a recipe so precise that someone who doesn't understand the goal could still follow it and get the right answer. Computers…
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…