2

This question is related to dynamic programming and specifically rod cutting problem from CLRS Pg 362

The overall optimal solution incorporates optimal solutions to two related subproblems.

The overall optimal solution is obtained by finding optimal solutions to individual subproblems and then somehow clubbing them. I can't understand the intuition and concept. Any links, examples?

thanks

hershey92
  • 783
  • 2
  • 6
  • 17

1 Answers1

1

You can compare dynamic programming and greedy approach.

Optimal substructure means that optimal solution can be found by finding optimal solutions to subproblems. If this is not the case, than sum of optimal solution of subproblems doesn't give us optimal global solution.

For example, consider Dijkstra's algorithm. If we know shortest path from node A to node C than we can use this information to find shortest path to another nodes as well.

If this is not the case, we can't compose optimal solutions to subproblems and get global optimal solution, than we can use greedy approach. Look at change making problem for example. Greedy algorithm makes local optimal decisions and find some solution, but this solution is not guaranteed to be optimal.

Evgeny Lazin
  • 9,193
  • 6
  • 47
  • 83