Dynamic Programming - Main Set
What are the two base cases for the station placement problem?
1). There is only one station. Put it right in the middle of the towns. Locate(i,1) 2) There is only 1 town so you basically take 1 station and put it right at the town so the cost is zero. Locate(n, k)
For the station placement problem, what is the top level question?
For what i are the first i towns served by the leftmost station?
What are the main ingredients of a DP solution?
Notation: Understand the subproblems that need to be solved and come up with appropriate solution (in this case M[j]) Efficiency: Notation allows you to count the number of subproblems that need to be solved. Ensure that there are not too many of them. Recurrence Relation: Express answer to a subproblem in terms of answers to smaller subproblems, taking max or min of choices. Memoization: In recursive solution, make sure you don't solve any subproblem more than once