[PDF] [PDF] CSE373 Fall 2013 Example Exam Questions on Dijkstras Algorithm

Step through Dijkstra's algorithm to calculate the single-source shortest paths from F Y 10 7 A E G Y 3 B Lowest-cost path from A to F: A to B to C to E to F  



Previous PDF Next PDF





[PDF] Shortest path problem (Dijkstras algorithm) - Pearson Schools and

The shortest route is ACEF In this example there are only four possibilities to consider, but if the network were more complex then this method, called a



[PDF] Lecture 18 Solving Shortest Path Problem: Dijkstras Algorithm

23 oct 2009 · Algorithm's general description • Algorithm steps in detail • Example Floyd- Warshall and Bellman-Ford algorithm solve the problems on 



[PDF] Dijkstras Shortest Path Algorithm - Maplesoft

Dijkstra's Shortest Path Algorithm is a well known solution to the Shortest Paths problem, which consists in finding the shortest path (in terms of arc weights) from  



[PDF] Lecture 9: Dijkstras Shortest Path Algorithm

Breadth-first-search is an algorithm for finding short- est (link-distance) paths from a Dijkstra's Algorithm Example: s a b c d 7 2 3 2 1 8 5 4 5 0 inf inf inf inf



[PDF] Dijkstras Single Source Shortest Path Algorithm

Indeed, the tree rooted at s in the BFS forest is the solution extract-min(S) which removes and returns the element with the Dijkstra's Algorithm Example a b



[PDF] Graph Search Tutorial

The following figure shows the graph and NewReachables set after the initialization phase of Dijkstra's shortest path algorithm, where each vertex is labeled with



[PDF] CSE373 Fall 2013 Example Exam Questions on Dijkstras Algorithm

Step through Dijkstra's algorithm to calculate the single-source shortest paths from F Y 10 7 A E G Y 3 B Lowest-cost path from A to F: A to B to C to E to F  



[PDF] Dijkstras Algorithm Learning Tool - School of Computer Science

3 mai 2016 · 2 3 3 Example Networks1: Dijkstra's Algorithm for Shortest Route Dijkstra's algorithm is one of the most significant algorithms in graph theory 



[PDF] Basic problem 3 Formulas for Dijkstras algorithm for a graph with n

Dn = min {Dn, Du +Ru,n} k =3, 4, , n-1 Example 5 Let's solve the problem from example 4 using Dijkstra's algorithm Solution The distances matrix is 

[PDF] dine in restaurants near me breakfast

[PDF] dine in restaurants near me covid

[PDF] dine in restaurants near me covid 19

[PDF] dine in restaurants near me for dinner

[PDF] dine in restaurants near me now

[PDF] dine in restaurants near me open late

[PDF] dine in restaurants near me open now

[PDF] dine in restaurants near me that are open

[PDF] diner french meaning

[PDF] dinfos address

[PDF] dinfos courses

[PDF] dinfos facebook

[PDF] dinfos logo

[PDF] dinfos paqc

[PDF] dinfos pavilion

CSE373 Fall 2013

Example Exam Questions on Dijkstra's Algorithm

(and one on Amortized Analysis) Name:

1. Consider the following undirected, weighted graph:

Step through Dijkstra's algorithm to calculate the single-source shortest paths from A to every other

vertex. Show your steps in the table below. Cross out old values and write in new ones, from left to

right within each cell, as the algorithm proceeds. Also list the vertices in the order which you marked

them known. Finally, indicate the lowest-cast path from node A to node F.

Solution:

Known vertices (in order marked known):ABCGED or FD or F

VertexKnownCostPath

AY0 BY1A

CY3 2A B

DY8 7B E

EY6 5B C

FY10 7A E

GY3B Lowest-cost path from A to F:A to B to C to E to F Name:

2. Consider the following directed, weighted graph:

(a) Even though the graph has negative weight edges, step through Dijkstra's algorithm to calculate supposedlyshortest paths from A to every other vertex. Show your steps in the table below. Cross out old values and write in new ones, from left to right within each cell, as the algorithm proceeds. Also list the vertices in the order which you marked them known.

Solution:

Known vertices (in order marked known):ABDFCGE

VertexKnownDistancePath

AY0 BY2A CY7A DY4B

EY12 9A C

FY6D GY8F (b) Dijkstra's algorithm found the wrong path to some of the vertices. For just the vertices where the wrong path was computed, indicateboththe path that was computed and the correct path. (c) Whatsingleedge could be removed from the graph such that Dijkstra's algorithm would happen to compute correct answers for all vertices in the remaining graph?

Solution:

(b) Computed path to G is A,B,D,F,G but shortest path is A,C,E,G. Computed path to D is A,B,D but shortest path is A,C,E,G,D. Computed path to F is A,B,D,F but shortest path is A,C,E,G,D,F. (c) The edge from E to G. Name:

3. Suppose we dene a dierent kind of graph where we have weights on the vertices and not the edges.

Does theshortest-paths problemmake sense for this kind of graph? If so, give a precise and formal

description of theproblem. If not, explain why not. Note we are not asking for an algorithm, just what

the problem is or that it makes no sense.

Solution:

Yes, this problem makes sense: Given a starting vertexvnd the lowest-cost path fromvto every other vertex. The cost of a path is the sum of the weights of the vertices on the path. Name:

4. Consider using a simple linked list as a dictionary. Assume the client will never provide duplicate

elements, so we can just insert elements at the beginning of the list. Now assume the peculiar situation

that the client may perform any number of insert operations but will only ever perform at most one lookup operation. (a) What is the worst-case running-time of the operations performed on this data structure under the assumptions above? Brie y justify your answer. (b) What is the worst-case amortized running-time of the operations performed on this data structure under the assumptions above? Brie y justify your answer.

Solution:

(a) inserts areO(1) (push on the front of a linked list), but the lookup isO(n) wherenis the number of inserted items since the lookup may be last and be for one of the earliest inserted items (b) amortized all operations are nowO(1). Inserts are stillO(1). And the lookup can take at most timeO(n) wherenis the number of previously inserted items. So the total cost of anynoperations is at mostO(n), which is amortizedO(1).quotesdbs_dbs14.pdfusesText_20