This preview shows page 1. Sign up to view the full content.
Unformatted text preview: eck whether there is a gas station there. If there is a
gas station at this vertex, then we add the edges (ve , vf ) and (vh , vf ) to E . Since the
cost of fueling up is not dependent on the amount of gas that is already in the tank,
we assign both of these edges the cost of fueling up at that city. This procedure takes
O(V ) time, since we iterate over all of the vertices and create a constant number of
new edges. 13 6.006 Quiz 2 Solutions Name We can now run Dijkstra’s algorithm on this graph to ﬁnd paths from sf to tf , th...
View Full
Document
 Fall '11
 ErikDemaine

Click to edit the document details