set13_sol

set13_sol - CS112 Spring 2011: Problem Set 13 Dijkstra's...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS112 Spring 2011: Problem Set 13 Dijkstra's Algorithm/Quicksort ------------------------------------------------------------------------ 1. Suppose you are given this undirected graph in which the vertices are towns, and the edges are toll roads between them. The weight of an edge is the dollar amount of toll. Use Dijsktra's shortest paths algorithm to determine the minimum toll route from A to all other cities. * Show each step of the algorithm in tabular form. Here's the table after the initial step: Done D[B] D[C] D[D] D[E] D[F] D[G] D[H] D[I] --------------------------------------------------------------------- A 4,A 8,A ? ? ? ? ? ? Note that along with the distance, the "previous" vertex is also shown. * Draw the shortest path tree induced on the graph. *SOLUTION* * Done D[B] D[C] D[D] D[E] D[F] D[G] D[H] D[I] --------------------------------------------------------------------- A 4,A ? ? ? ? ? 8,A ? B 12,B ? ? ? ? 8,A ? H 12,B ? ? ? 9,H 15,H G 12,B ? ? 11,G 15,H F 12,B 25,F 21,F 15,H C 19,C 21,F 14,C I 19,C 21,F D 21,F E Note that along with the distance, the "previous" vertex is also shown.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

set13_sol - CS112 Spring 2011: Problem Set 13 Dijkstra's...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online