# u3 u4 gas 5 gas 3 toll 7 t toll 3 toll 10 s gas free

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

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: el across one edge to a gas station where we reﬁll our tank, and then travel two edges to the destination, arriving with an empty gas tank. Notice that we are unable to continue the journey to u5 if we wanted to, because even though there is a gas station there, we have to traverse a third edge to get to it.) u3 u4 Gas: \$5 Gas: \$3 Toll: \$7 t Toll: \$3 Toll: \$10 s Gas: Free NO GAS Toll: \$2 Toll: \$1 Toll: \$4 Toll: \$5 Toll: \$2 NO GAS u1 Toll: \$1 NO GAS Toll: \$9 u2 Toll: \$1 Gas: \$1 u5 There are some extra copies of this graph at the end of the exam (for your convenience). 6.006 Quiz 2 Solutions Name (a) [5 points] The valid path given in the description above is not the best path. Find a least-expensive path from s to t in the graph above. Solution: (s, u1 , u3 , u2 , t) (b) [5 points] Find the least-expensive path from s to u5 in the graph above. Solution: (s, u1 , u3 , u2 , u4 , t, u5 ) (c) [15 points] Give an O(V log V + E ) algorithm to ﬁnd, in a given graph G = (V, E, w), a least-expensive...
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