greedy algorithm term
make the locally-optimal choice at each step
Sometimes optimal (Dijkstra, Huffman, MST), often not (knapsack). Powerful when it works because it's simple; trap when 'greedy gets stuck.'
make the locally-optimal choice at each step
Sometimes optimal (Dijkstra, Huffman, MST), often not (knapsack). Powerful when it works because it's simple; trap when 'greedy gets stuck.'