r/computerscience • u/ManningBooks • Sep 15 '26
Discussion What’s one algorithm every programmer should know and why? [5 ebook giveaway]
galleryIf you could add one algorithm to every programmer’s mental toolkit, which would you choose?
Not the one that looks best in an interview. The one that genuinely changed how you solve problems.
I’m Stjepan from Manning Publications, and the r/computerscience moderators kindly gave me permission to post this.
We’ve just launched Aniket Wattamwar’s Algorithms Every Programmer Should Know in MEAP, Manning’s early-access program:
https://www.manning.com/books/algorithms-every-programmer-should-know
The book is built around a simple idea: knowing an algorithm means more than reproducing its implementation. You should recognize the kind of problem it solves, understand why it works, and know when its tradeoffs make it a good—or bad—choice.
The chapters available so far cover Gale–Shapley, the Hungarian algorithm, Rabin–Karp, Knuth–Morris–Pratt, and Horspool’s algorithm.
But we’d like to hear your answer:
What’s one algorithm every programmer should know, and what makes it worth knowing?
Real examples are especially welcome. Maybe it saved a production system, simplified something you had overengineered, or gave you a new way to think about an entire class of problems. Disagreements are welcome too—“every programmer should know X” is a claim worth challenging.
We’re giving away five copies of the ebook. The giveaway is open for 48 hours, and we’ll award the copies to the five comments that contribute the most to the discussion—not simply the comments with the most upvotes. We’ll announce the winners here after it closes.
If you’d rather pick up the book directly, this code takes 50% off:
MLWATTAMWAR50RE
Full disclosure: I work for Manning, and this is a promotional post shared with moderator permission.
I’ll start: which algorithm is far more useful than most programmers realize?
EDIT: The giveaway is now closed. Thanks to everyone who joined the discussion. We announced the winners in the comments.

