Kernighan Names Every Algorithm
Why is this CS Fundamentals meme funny?
Level 1: Two Magic Tools
This is like someone asking a carpenter to name every tool ever made, and the carpenter just smiles and says, "hammer and saw." The funny part is that the answer is way too small for the question, but it also sounds like it might handle most ordinary jobs.
Level 2: Sort, Then Search
An algorithm is a step-by-step method for solving a problem. Sorting puts items in order. Searching finds an item. Those are two of the first ideas many programmers learn because they show up everywhere: contacts lists, search results, databases, logs, indexes, inventories, and leaderboards.
qsort is a C standard-library function used to sort arrays. bsearch is used to do binary search, which repeatedly checks the middle of a sorted list to find a target faster than looking at every item one by one. The catch is that bsearch needs the data to already be sorted, so the two functions naturally fit together.
The image is funny because the demand is impossible and dramatic, but the answer is tiny and confident. It says, in effect: "All algorithms? Fine. Sort it, search it, ship it." For a junior developer, that is both a joke and a useful lesson. You do not always need to invent a clever algorithm. Often you need to understand the standard tools well enough to use them safely.
Level 3: Standard Library Supremacy
OH YOU'RE A PROGRAMMER
NAME EVERY ALGORITHM
QSORT & BSEARCH
The top panel makes the absurd demand: prove you are a programmer by naming "every algorithm." The bottom panel answers with QSORT & BSEARCH, which is funny because it compresses the sprawling universe of CS fundamentals into two old, practical C library calls. The post message identifies the smiling figure as Brian Kernighan, so the answer carries the authority of classic Unix and C culture: not "here is my LeetCode taxonomy," but "here are the two routines that got half the job done before your framework existed."
The deeper joke is that qsort and bsearch are not just algorithm names in a textbook sense. In C, they are standard-library functions that hide a lot of ceremony behind painfully generic interfaces. qsort sorts an array using a comparator. bsearch searches a sorted array, also using a comparator. Together they represent a very old-school workflow: arrange the bytes, then ask the bytes where something is. Elegant, portable, sharp-edged, and perfectly happy to ruin your afternoon if the comparator is wrong.
int cmp_int(const void *a, const void *b) {
int x = *(const int *)a;
int y = *(const int *)b;
return (x > y) - (x < y);
}
qsort(values, count, sizeof values[0], cmp_int);
found = bsearch(&needle, values, count, sizeof values[0], cmp_int);
Experienced C developers also hear the unspoken caveats. The C standard promises behavior, not necessarily the exact sorting algorithm implied by the name qsort. The comparator has to define a consistent ordering. bsearch only works correctly after the data is sorted according to that same ordering. The API uses void *, so the compiler cannot protect you from several creative ways to lie to yourself. It is algorithm design reduced to a function pointer and trust, which is very C: powerful, minimal, and only slightly haunted.
The meme also pokes at technical interviews. "Name every algorithm" is a parody of gatekeeping questions that treat programming as trivia recall. Kernighan's answer sidesteps the premise. A veteran does not need to enumerate every graph traversal, dynamic programming pattern, and cache-aware sorting variant to prove fluency. Sometimes the real flex is knowing which boring library primitive is enough.
Description
The top panel uses the Gru-with-a-gun meme format, with large white text saying "OH YOU'RE A PROGRAMMER" and "NAME EVERY ALGORITHM" while Gru points a weapon toward the viewer. The bottom panel shows Brian Kernighan smiling in an office-like setting, captioned "QSORT & BSEARCH". The post metadata says "Brian Kernighan knows every algorithm", grounding the joke in C and Unix programming culture. The punchline is that a veteran C programmer can reduce the impossible demand to two familiar standard-library workhorses: `qsort` for sorting and `bsearch` for lookup.
Comments
1Comment deleted
Decades of algorithm discourse, reduced to two function pointers and a comparator that still somehow returns the wrong sign once a year.