DP2: Flight Problem

San Skulrattanakulchai

October 9, 2018

The Flight Problem

Define a quantity & obtain a recurrence

Table-filling procedure

Example table

The technique

Finding optimal route

Printing the cheapest route.

Notes

  1. The cost function does not have to be given as a table. It may be given as a formula, for example. We assume in this slide that given any cities \(i\), \(j\), the cost \(c(i,j)\) can be found in \(O(1)\) time.
  2. In the definition of \(m\), we can make the starting city the variable instead of making the destination city the variable. This will give a backward recurrence.
  3. We can solve the problem with extra conditions by either modifying the cost function, or the recurrence.
  4. Problems admitting solutions by dynamic programming exhibit the Optimal Substructure Property—embedded within an optimal solution are optimal solutions to subproblems.