JA EN
Learn › Algorithms

Data Structures

Arrays, trees, hashes, heaps — what each choice buys you

01 ·Data Structures·FREE·7 min read Choosing a Data Structure — Arrays, Hashes, Trees and Heaps What arrays, hash tables, trees and heaps each make fast, and what each one gives up in return. A pick-by-use-case table, plus which structures actually show up in tokenizers, vector search and KV caches. 02 ·Data Structures·★ MEMBER·PAPER·9 min read Hashing and Nearest-Neighbor Search — The Groundwork Under Vector Search Two inventions that made looking things up fast — the exact-match hash table, and LSH and HNSW for searching by meaning — from zero assumed knowledge. What is actually running underneath RAG and every vector database. 03 ·Data Structures·★ MEMBER·11 min read Cache-Friendly Code — Why Two O(n) Loops Can Differ by 10× Two implementations with identical complexity can differ by an order of magnitude, because the CPU never fetches one value — it fetches a 64-byte block. Locality, cache lines, arrays versus linked lists, AoS versus SoA, loop order and false sharing, from zero assumed background to checking it yourself with perf. 04 ·Data Structures·★ MEMBER·10 min read B-Trees and LSM-Trees — The Heart of Every Database Almost every database ever shipped sits on a B-tree or an LSM-tree. Starting from one physical fact — storage can only be written a page at a time — here is why the two designs came out opposite, what write amplification really is, and how PostgreSQL and RocksDB differ, from zero background to the knobs you actually turn. 05 ·Data Structures·★ MEMBER·PAPER·13 min read Probabilistic Data Structures — Counting Without Counting Bloom filters, HyperLogLog and the Count-Min sketch explained from zero — how giving up the right to always be correct buys you memory that never grows, and how large services actually operate these sketches.