02 Greedy Techniques - broyda/cp-lib GitHub Wiki

Common techniques

  1. Sorting and applying some greey idea

  2. Multiset/priority queue - insert/delete based on some property

  3. Reversal of approach/thinking backward

  4. Splitting dimension - for example, converting a 2 D problem into couple 1D's and arguing for one dimension.

  5. Classical ideas - range based etc. (finish first/last etc.)

  6. classical problems - machine job allocation
    Variants - starting time, length, ending time - Earliest ending time yields the best solution

  7. Multiset can be used when priority queues are used. Consider multiset as superset of PQs.

  8. Knapsack - Dynamic Programming
    Fractional knapsack - Greedy
    whereas
    Activity Selection - Greedy
    Weighted Activity Selection - Dynamic Programming