This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: o Run Time: O(n+e) Step 0: O(n+e) Step 1: O(n) Step 2: O(e) Overall: O(n+e) Dijkstra's Shortest Path Algorithm Weighted graphs (Positive) Used for finding the shortest distance between point a to point b "Greedy" algorithms o Go for the best current solution, then correct later if a better solution is found o Trial and error Similar to BFS Need an array that contains the best path from the sources to that vertex Array D stores current best distance from source to each vertex Array Previous keeps for each vertex, the previous vertex n current shortest path from source to it Fringe: set of all vertices that are not done & have non Step Done D[B] D[C] D[D] D[E] D[F] D[G] A 5 10 1 B10 11 8 2 E10 10 10 A 0 C 2 B 1 D 3 E 4...
View
Full
Document
This note was uploaded on 02/29/2012 for the course 198 112 taught by Professor Venugopal during the Spring '09 term at Rutgers.
 Spring '09
 VENUGOPAL

Click to edit the document details