Top-K — Heap Is Not Always the Answer

A heap is the reflex answer to K-th largest problems, but when the whole array is already in memory, Quick Select is faster on average. The size-K heap and Quick Select mechanics, and how the shape of the data decides between them.

July 9, 2026 · 5 min read

Union-Find — Two Optimizations Make It Practically Constant

Union-Find gives each group a root representative and decides whether two elements share a group. The unoptimized version stretches find to O(N) on chain trees; path compression and union by rank make it practically constant.

July 4, 2026 · 5 min read

Topological Sort — Process Zero In-degree First

Kahn’s BFS for topological sort repeatedly takes nodes with zero in-degree, and cycle detection comes along without extra logic. The mechanism, the Course Schedule problems, and the selection criteria against DFS post-order.

July 3, 2026 · 5 min read

Sliding Window and Prefix Sum — When Monotonicity Decides

Subarray-sum problems collapse from O(N²) to O(N) along two paths — sliding window or prefix sum with a hash. Negative inputs or strict-equality conditions break monotonicity and shift the work from sliding window to prefix sum.

June 14, 2026 · 4 min read

Parametric Search — Binary-search the Answer

When the answer isn’t sitting in any array, you can still binary-search the answer itself. The parametric-search recipe — define the decision function, fix the direction of monotonicity, justify lo and hi.

June 13, 2026 · 5 min read

quant-investment-platform — mid-retrospective

A mid-project retrospective on a personal automated trading platform built with Rust + Python + React. With ETF rebalancing and single-stock signal trading both in place, a record of how the safety layers — halt, block, detect, simulate — got built before going live.

May 31, 2026 · 7 min read

Three Type Systems and Runtimes — JVM, CPython, and the Go Compiler

Java pairs static strong typing with JVM bytecode and adaptive JIT optimization. Python combines dynamic typing with an interpreter and declarative type hints. Go ships static structural typing and a single compiler. The type-system decision drives the runtime mechanism.

June 16, 2024 · 6 min read

Three Concurrency Models — GIL, Virtual Thread, and Goroutine

CPython’s GIL serializes multithreaded execution and pushes work onto multiprocessing or asyncio. Java pinned threads 1:1 to the OS until virtual threads (Java 21) reopened the thread-per-request model. Go shipped with an M:N scheduler from day one. The model you start from decides whether your service goes thread-per-request, reactive, or multiprocess.

June 15, 2024 · 6 min read

Three Garbage Collectors — How Java, Python, and Go Reclaim Memory

All three languages use a garbage collector, but the priorities differ. Java leans on generational + region GCs (G1, ZGC), Python combines reference counting with a cyclic detector, and Go runs a single concurrent tri-color mark-and-sweep. What each GC gave up is what shapes its operational profile.

June 14, 2024 · 6 min read

Everything Is Pass by Value — Memory Transfer in Go, Java, and Python

Calling a function with an object is often described as pass by reference, but in memory all three languages copy values. Java copies a reference value, Python binds a new name to the same object (call by sharing), and Go copies a struct header — escape analysis decides where the values live.

June 13, 2024 · 7 min read