User types three characters and expects instant suggestions. A hash map can’t do prefix lookups. A trie can, in O(k) time where k is the query length.
Posts for: #Algorithms
Content Fingerprinting: Detecting Near-Duplicates at Scale
Exact duplicates are easy. Near-duplicates are hard. SimHash turns documents into compact fingerprints where similar content produces similar hashes.
Base62 Encoding: Turning Numbers into Short Strings
A 64-bit integer is 19 digits. Encode it in base62 and it’s 7 characters. The math behind compact, URL-safe identifiers.
Relevance Scoring: Why Chronological Order Breaks Down
Showing content in time order is simple until your users follow thousands of sources. Scoring and ranking turns a firehose into a useful stream.
Rate Limiting: Token Bucket vs Leaky Bucket
Protecting services from overload with rate limiting. Token bucket and leaky bucket algorithms explained with Java implementations and real-world trade-offs.
Retry Strategies: Exponential Backoff and Jitter
How to retry failed requests without overwhelming servers. Exponential backoff, jitter, and when to give up. Java implementations and real-world patterns.
Load Balancing Strategies: Picking the Right Server
Comparing load balancing algorithms - Round Robin, Least Connections, Weighted Round Robin, and IP Hash. Java implementations and real-world trade-offs.