browse/

9 results
computers/endianness-why-the-bytes-of-a-number-can-be-stored-backwards.md Endianness: why the bytes of a number can be stored backwards Store the number 0x12345678 in memory and you might expect the bytes in the order 12 34 56 78. Most laptops and phones store them as 78 56… 5 min read · 7 Nov computer-science/binary-search-trees-why-the-order-you-insert-numbers-changes-how-fast.md Binary search trees: why the order you insert numbers changes how fast you can find them A binary search tree keeps numbers in order with one rule: smaller goes left, bigger goes right. Build one yourself, watch a search light… 4 min read · 30 Oct databases/sql-indexes-why-finding-one-row-among-200-000-takes-about-18-steps.md SQL indexes: why finding one row among 200,000 takes about 18 steps A database with 200,000 customers can answer "find this email" by reading every row, or by reading about 18 entries. The difference is an… 4 min read · 20 Oct computers/floating-point-why-0-1-0-2-is-not-exactly-0-3.md Floating point: why 0.1 + 0.2 is not exactly 0.3 Type `0.1 + 0.2` into JavaScript or Python and you get `0.30000000000000004`. It is not a bug, and it is not your mistake. Computers store… 5 min read · 19 Oct 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… 4 min read · 14 Oct computers/bits-and-bytes-why-a-byte-can-t-count-past-255.md Bits and bytes: why a byte can't count past 255 A byte is eight on/off switches, and that tiny size explains a lot of odd bugs. In this article you flip the bits of one byte yourself and… 4 min read · 13 Oct languages/why-does-0-1-0-2-give-0-30000000000000004-in-python.md Why does 0.1 + 0.2 give 0.30000000000000004 in Python? Type 0.1 + 0.2 into Python and you get 0.30000000000000004. It is not a bug: computers store fractions in binary, and one tenth has no… 4 min read · 4 Oct 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… 10 min read · 1 Oct computers/counting-with-only-0-and-1-how-computers-store-numbers-and-letters.md Counting with Only 0 and 1: How Computers Store Numbers and Letters Every photo, message and web page on your computer is stored as numbers written with just two digits: 0 and 1. That's binary, and it works… 9 min read · 1 Oct