Skip to content
Blog
Go back

The Greedy Algorithm

I was reading a fun bit of analysis of value of a pound of coins on Dan Kozikowski’s blog and stumbled upon the greedy algorithm (via wikipedia):

A greedy algorithm is an algorithm that follows the problem solving heuristic of making the locally optimal choice at each stage with the hope of finding a global optimum.

So, you pick to local max (the highest value coin in this example) and it ends up getting you the global max (the fewest number of coins to make the total value).

Knowing the names of little things like the greedy algorithm is definitely something I’m trying to work on these days. It just doesn’t look good on interviews when I have to go back and forth a few times before going “ohhhh, right that thing. I’ve used that before but I didn’t know that’s what it was called.”


Share this post on:

Previous Post
Email is not a messaging protocol, it’s a to-do list, right? Or at least my inbox is a to-do list and email is the protocol for...
Next Post
Getting Cygwin to see my local file system.