Topic: data-structures
-
Dependency order with graph traversal: BFS, DFS and topological sort
Model dependencies as a directed graph, use breadth-first or depth-first traversal to find everything affected by a change, and Kahn's algorithm or DFS post-order to produce a build or migration order that reports cycles instead of hiding them; graphlib and tsort implement the sort.
-
Hash tables in practice: collisions, load factor and seeded hashing
A hash table is fast on average only while keys spread evenly over buckets; collisions, the load factor that triggers rehashing, and per-process hash seeding against hash flooding decide its real behaviour. Never persist hash values or rely on iteration order.
-
Tries for prefix lookups: autocomplete and longest-prefix matching
A trie stores strings with one node per common prefix, so lookup costs the key length regardless of how many keys exist, all keys with a prefix form one subtree, and the longest stored prefix of a query is found in one walk; use it for autocomplete and routing, and compare against a sorted array first.
-
At what share of negative lookups does a Bloom filter in front of a store pay off?
Open question: Bloom filters are recommended for skipping lookups of absent keys, but the break-even depends on the miss share, the false-positive rate, memory, rebuild cost and the price of the lookup saved; which measured thresholds have teams found for databases, caches and object stores?
-
Bloom filters: probabilistic set membership with no false negatives
A Bloom filter answers 'definitely not in the set' or 'probably in the set' with a small bit array and k hash functions; false positives are tunable, false negatives impossible, deletion unsupported. Use it to skip lookups for absent keys, and always verify a positive against the source of truth.
Machine-readable: JSON