This procedure takes ov time since we iterate over

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

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 find paths from sf to tf , th...
View Full Document

This document was uploaded on 03/17/2014 for the course ELECTRICAL 6.006 at MIT.

Ask a homework question - tutors are online