uccser/cs-field-guide

View on GitHub
csfieldguide/chapters/content/en/glossary/greedy-algorithm.md

Summary

Maintainability
Test Coverage
# Greedy algorithm

An algorithm where; for every choice, all future choices are ignored and the most immediately beneficial decision is made.

Coinage has been designed with this in mind – a greedy algorithm can find the fewest number of coins required for any given amount of money.
However, in many other situations the greedy algorithm does not give the most optimal result.