본문 바로가기

Algorithm/Etc

Greedy Algorithm2

• What did we do for activity selection?


1. Determine the optimal substructure.
2. Develop a recursive solution.
3. Prove that at any stage of recursion, one of the optimal choices is the greedy choice.
   Therefore, it’s always safe to make the greedy choice.
4. Show that all but one of the subproblems resulting from the greedy choice are empty.
5. Develop a recursive greedy algorithm.
6. Convert it to an iterative algorithm.

 

 

Regarding optimal structure when applying it to greedy algorithm :
• Just show that optimal solution to subproblem and greedy choice
-> optimal solution to problem.

'Algorithm > Etc' 카테고리의 다른 글

우선순위 큐  (0) 2020.10.23
Huffman code  (0) 2020.10.23
Queue / Stack  (0) 2020.10.20
[Greedy Algorithm] coin change  (0) 2020.10.15
[DFS] 저울 추 ( p. 197 )  (0) 2020.10.14