Glossary: Coding Interviews in C++
Greedy
Also written: greedy algorithm
Taking the best-looking choice at each step. It works for only some problems; for bags of 2, 5 and 6 lb it fails to find the fewest bags for 13 lb.
Glossary: Coding Interviews in C++
Also written: greedy algorithm
Taking the best-looking choice at each step. It works for only some problems; for bags of 2, 5 and 6 lb it fails to find the fewest bags for 13 lb.