Category
hashing
3 articles in this category
What are Hash Tables? Basics Explained
TLDR: A hash table gives you near-O(1) lookups, inserts, and deletes by using a hash function to map keys to array indices. The tradeoff: collisions (when two keys hash to the same slot) must be handled, and a full hash table must be resized. š Th...
LLD for URL Shortener: Designing TinyURL
TLDR: A URL Shortener maps long URLs to short IDs. The core challenge is generating a globally unique, short, collision-free ID at scale. We use Base62 encoding on auto-incrementing database IDs for deterministic, collision-free short codes. š The...
Consistent Hashing: Scaling Without Chaos
TLDR: Standard hashing (key % N) breaks when $N$ changes ā adding or removing a server reshuffles almost all keys. Consistent Hashing maps both servers and keys onto a ring (0ā360°). When a server is added, only its immediate neighbors' keys move, mi...
