Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 478 Bytes

greedy.md

File metadata and controls

14 lines (10 loc) · 478 Bytes

greedy

intro

  • greedy algorithms is to pick the locally optimal solution at each step with the hope of finding the global optimum
  • dp vs greedy
    • in dp, we solve overall problem by combining the solutions about subproblems
    • in greedy, we make a series of localized optimal choices without considering the overall problem

pattern

  • greedy
    • we need to make the locally optimal choice
    • sometimes, use sorting or heap can help us make greedy choice