Skip to content

Glossary: Coding Interviews

Greedy

Also written: greedy algorithm

Taking the best-looking choice at each step. It only works for some problems, and fails for the 13 lb bag example with bags of 2, 5 and 6 lb.

Where the book teaches it

Related terms

Dynamic programming (DP)Topological sort, union-find, trie, bit tricks, Dijkstra