This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: we argue that S’ is legal (i.e. you never run out of gas). By definition of the greedy choice you can reach g. Finally, since S is optimal and the distance between g and s2 is no more than the distance between s1 and s2, there is enough gas to get from g to s2. The rest of S’ is like S and thus legal. Optimal Substructure Property: Let P be the original problem with an optimal solution S. Then after stopping at the station g at distance di the subproblem P’ that remains is given by di+1, . . . , dn (i.e. you start at the current city instead of USC). Let S’ be an optimal solution to P’. Since, cost(S) = cost(S’) + 1, clearly an optimal solution to P includes within it an optimal solution to P’....
View
Full
Document
This note was uploaded on 02/15/2011 for the course CS 570 taught by Professor Shahriarshamsian during the Spring '08 term at USC.
 Spring '08
 SHAHRIARSHAMSIAN

Click to edit the document details