{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

notes83

notes83 - Notes for week of Dijkstra's Algorithm Pseudocode...

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

View Full Document Right Arrow Icon
Notes for week of 2005-04-25 Dijkstra's Algorithm Pseudocode Minimum Spanning Tree Minimum Spanning Tree Pseudocode Final Exam Review Red Black Trees Merge Sort Quick Sort Sorting Algorithms for values in a subrange of numbers. Data compression Graphs Distribution of questions. Study Cooperation Cases Strategy Dijkstra's Algorithm Shortest path from a source vertex to other vertices. Pseudocode Algorithm for Shortest Path (G, S, D) Input A weighted graph G. Paths start at S. Output An array D[U] such that D[U] will be the cought(??) of the shortest path from S to U in G. Initialize D[s] = 0 and D[U] = INF for each U != S. Initialize Q = { all vertices in G }. Q is a list (queue). It is used to keep track of visited vertices. while Q is not empty do: Get a vertex U from Q such that D[U] is the minimum among all vertices of Q. For each vertex adjacent to U such that z is in Q do: if D[U] + W[U,z] < D[z] then D[z] = D[U] + W[U,z] end if end for end while
Background image of page 1

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

View Full Document Right Arrow Icon
Let m be number of edges and n be number of vertices. Then the complexity is either O(n^2 + m) if we use a simple list or queue or O(n log n + m) if we use a heap. Minimum Spanning Tree Spanning tree with minimum total weight. Example: Connect all computers in the building with the minimum amount of cable. Properties Let V' and V'' be a partition of the vertices of G. A partition is two sets of vertices that are mutually exclusive. Let (V', V'') be an edge across the partition, such that V' E V' and V'' E V''. If the edge e = (v', v'') has the minimum weight across all the edges that join the partition, then e = (v', v'') should be in the minimum spanning tree. In the previous partition, the edge with weight of 8 should be in the minimum spanning tree (C, D). This guarantees that the partition will be joined by the minimum edge. Procedure
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 7

notes83 - Notes for week of Dijkstra's Algorithm Pseudocode...

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

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