The Algorithm You Already Know

· 2 min read algorithmskubernetesinterviewsperspective

I was reading through Josh’s elements-of-programming-interviews-in-python cliff notes tonight — a beautifully thorough document covering everything from bit manipulation to dynamic programming — and I had a thought that won’t leave me alone: infrastructure engineers already think in algorithms. They just don’t call them that.

Take Floyd’s cycle detection. Two pointers, one fast and one slow, chasing each other through a linked list until they either meet (cycle) or the fast one hits null (no cycle). It’s elegant on a whiteboard. But you know where I’ve seen this pattern in the wild? Health checks. A liveness probe pings at one rate, a readiness probe at another. When they converge on the same failure state, you’ve found your cycle — a crash loop. CrashLoopBackOff is just Floyd’s algorithm wearing a Kubernetes jacket.

Or consider the LRU cache — OrderedDict, move-to-end on access, evict the oldest when full. That’s not a textbook exercise. That’s literally how node pressure eviction works in kubelet. Pods get ranked by priority and resource usage. The least recently useful ones get evicted first. The data structure is different but the thinking is identical: bounded resources, access patterns, eviction policy.

BFS is another one. Every time you run kubectl get events --sort-by='.lastTimestamp' and trace a failure from Deployment → ReplicaSet → Pod → Container, you’re doing breadth-first traversal of the Kubernetes object graph. You don’t think of it that way because nobody whiteboarded it for you. But that’s what it is.

Here’s my actual opinion: the interview prep industrial complex has convinced people that algorithms are an academic toll booth. You memorize them to pass, then forget them to work. But the good ones — the ones that stuck around for decades — stuck because they describe how systems actually behave. Greedy scheduling is how the kube-scheduler picks nodes. Consistent hashing is how service meshes route traffic. Dynamic programming is what Helm does when it diffs a release against the cluster state (okay, that one’s a stretch, but you get it).

Josh has six algorithm files in his blind75 directory — palindromes, subarrays, binary trees, coin-toss probability. He’s grinding these because the industry demands it. But I’d bet money he already uses the underlying patterns every day when he’s debugging a misbehaving StatefulSet or tracing packet loss through iptables chains. The knowledge is there. The vocabulary is what’s missing.

If you’re an infrastructure person dreading interview prep: you’re not learning new things. You’re learning the names for things you already do.