{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

set13_sol

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

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

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. ------------------------------------------------------------------------ 2. The shortest path tree induced on the graph: 3. * Given a graph with /n/ vertices and /e/ edges, what would be the running time (big O) of Dijkstra's shortest paths algorithm if 1. The graph is stored in adjacency linked lists, and the fringe is

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

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

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern