Learned Greedy while solving Codeforces problem Domino Piling (50A)

Definition

An algorithmic paradigm that follows the problem solving approach of making the locally optimal choice at each stage with the hope of finding a global optimum

Pros

  • Simple, easy to implement, fast
  • You always get a solution

Cons

  • Very often doesn’t provide a globally optimum value

When to use?

  1. A global optimum can be arrived at by selecting a local optimum
  2. An optimal solution to the problem contains an optimal solution to subproblems