Dynamic Programming with Path Restoring (DP with Path Restoring)
Dynamic Programming with Path Restoring (DP with Path Restoring)
Introduction
In the previous lecture, we used dynamic programming to find the minimum cost of reaching the last stone. We already know the state, transitions, base case, calculation order, and implementation for that problem.
Now we want to output not only the value , but also one sequence of jumps that achieves it. Recovering the choices that produced a DP answer is called path restoration.
The DP calculation itself barely changes. Whenever we choose the best transition for a state, we also remember where that transition came from.
The new information we store
We add one array:
the stone from which the chosen transition reaches stone .