AI engineering glossary · Data structures algorithms

What is greedy algorithm?

Greedy algorithm: An algorithm that builds a solution step by step, always choosing the option that looks best right now and never reconsidering. It gives optimal answers for some problems, but for others only approximate ones.

Level: intermediateTopic: Data structures algorithms

Greedy algorithm: an example

Giving change of 41 in coins 25, 10, 5, 1 by taking the largest coin each time gives 25, 10, 5, 1, which is optimal for this coin set.

Related terms

More Data structures algorithms terms

Where you learn it

Greedy algorithm is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.