



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A set of lecture notes from a university course on algorithm design and analysis. The notes cover the topics of dijkstra's algorithm for finding shortest paths and minimum spanning trees (mst) using kruskal's, prim's, and reverse-delete algorithms. The notes include proofs of correctness, implementations, and examples.
Typology: Study notes
1 / 5
This page cannot be seen from the preview
Don't miss anything!




9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne^ Sofya Raskhodnikova
Greedy Graph Algorithms • • Shortest PathsMinimum Spanning Tree • Dijkstra’s
9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
%^ &'^ ^ ^ & $^ #
9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
&# ( 9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
S Q while ← ∅ ← do V Qu (^) ← ≠ ∅ EXTRACT Q keyed on is a priority queue maintaining-MIN π( Q [ v )] V – S , S for ← (^) do if each S ∪ (^) π v { then [ u ∈ v };] > Adjacency-list d (^) πππππ[[ u [ v ] u ] ← π] + ← d ([[ uuu ], (^) ] + v [) u ]( u , v ) leaving v exploreedges Implicit DECREASE-KEY
9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
Graph withnonnegativeedge lengths: A A (^1031) C B C B (^) 4 822 7 DE DE 9 9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
Initialize: Q: A 0 B ∞ (^) C ∞ D ∞ E ∞ A A 103 1 BC B C (^) 4 822 7 DE DE 9 S: {}
9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
10 3
Explore edges leaving A : ∞ ∞
9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
1077 3 1111 ∞ 9 ∞ 5
9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
times Handshaking Lemma^ n degree times(^ while u )^ do^ Q u^ S^ for ^ ←←^ ≠ ∅^ do if each^ E S m^ XTRACT∪ (^) implicit D^ dv {[ then^ u ∈ v }] >^ Adj -M (^) dd [IN[[ vuu ECREASE](]] + Q ←) w d ([ uu ,] +-K v ) (^) EY w ’s.( u , v ) &( 0 . - ./ , 5 1 # 0 67 4 # ) * 2 # $ (^) 8! (^) 9 : 9 : # 9 (^) +; " 3 " )
9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
? = > 9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
9/14/2007 (^) S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith, K. Wayne
T* contains e. • Proof: – Suppose e does not belong to T.– Adding e to T creates a cycle C in T*. (exchange argument)
% ^ 5 C