Blog
Notes on data structures & algorithms, system design, and things I learn along the way.
Learning DSA? Follow the structured path — ordered articles from recursion to dynamic programming.→How to release new versions with minimal risk: rolling updates, blue-green switches, canaries that expose a change to a small share of real traffic first, automated rollback on bad metrics, feature flags that separate deploy from release, and the database migrations that make rollback possible.
How an app like Uber or Ola matches riders with drivers: a high-write location service indexed by geo cell, matching ranked by ETA rather than distance, a trip state machine, live tracking over WebSockets, surge pricing, and the consistency questions behind 'two riders, one driver'.
Designing a crawler that fetches billions of pages politely: the URL frontier with per-host queues, robots.txt and rate limits, DNS caching, de-duplicating URLs with Bloom filters and content with fingerprints, avoiding crawler traps, freshness scheduling, and scaling it all across machines.
A grid is a graph: each cell is a node, and its neighbours are its edges. How flood fill (the paint-bucket tool) and 'number of islands' are BFS or DFS over that implicit graph, how to avoid stack overflows and revisits, and the family of grid problems the same template solves.
How a cluster of hundreds of nodes agrees on who's alive without a central coordinator: each node periodically tells a random peer what it knows, information spreads in about log N rounds, and heartbeats riding along let everyone detect failures. With SWIM, phi accrual detectors, and the trade-offs.
Text responses shrink by 5–20× when compressed, and browsers ask for it on every request. How Accept-Encoding and Content-Encoding negotiate a format, how gzip, Brotli and zstd compare, static versus on-the-fly compression, what not to compress, and the one security caveat.
Give frequent symbols short codes and rare ones long codes. How Huffman's algorithm builds an optimal prefix code by repeatedly merging the two least frequent symbols with a min-heap, why no code is a prefix of another, and where Huffman coding still runs today — inside gzip, PNG and JPEG.
Why [10, 9, 1].sort() returns [1, 10, 9], how comparator functions work, why sort is stable and what that buys you, sorting text correctly with localeCompare and Intl.Collator, multi-key sorts, and toSorted() for sorting without mutating.
Objects make poor dictionaries: keys are coerced to strings, inherited properties get in the way, and size takes extra work. How Map and Set fix that — iteration order, identity-based keys, set operations, JSON — and how WeakMap and WeakSet stop object-keyed caches and metadata from leaking memory.
Every JavaScript number is a 64-bit binary float. Why that makes 0.1 + 0.2 equal 0.30000000000000004, why toFixed rounds 1.005 down, how large IDs silently change when parsed from JSON, and the practical rules: integer minor units for money, BigInt or strings for big IDs, and Intl for display.
202 posts · page 1 of 21