notes06 - CSE 2320 Notes 6: Greedy Algorithms (Last updated...

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

View Full Document Right Arrow Icon
CSE 2320 Notes 6: Greedy Algorithms (Last updated 3/26/12 13:59 A3/P3) 6.A. C ONCEPTS Commitments are based on local decisions: NO backtracking (will see in stack rat-in-a-maze - Notes 10) NO exhaustive search (will observe in dynamic programming - Notes 7) Approaches: 1. Sort all items, then make decisions on items based on ordering. 2. Items are placed in heap and then processed by loop with delete and priority changes. MAIN ISSUE: NOT efficiency . . . Quality of Solution instead Special situations - exact solution (these three path problems are an aside for now . . .) Prim’s Minimum Spanning Tree (Notes 15, min-heap) 0 1 4 2 3 6 5 7 10 4 2 4 7 2 2 3 1 3 3 2 1 1 2 5 0 - 3 3 3 2 2 2 n vertices - choose n - 1 edges to give tree with minimum sum of (undirected) edge weights. Path for each vertex is one that minimizes the maximum weight appearing on the path. Each vertex is labeled with its predecessor on path back to the source (vertex 0). Each round augments the tree with the minimum weight edge. So, vertices are finalized in ascending “min of maxes” order (0, 3, 6, 7, 2, 1, 5, 4).
Background image of page 1

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

View Full DocumentRight Arrow Icon
Dijkstra’s ( http://www.cs.utexas.edu/~EWD ) Shortest Path (Notes 16, min-heap) 0 1 4 2 3 6 5 7 10 4 2 4 7 2 2 3 1 3 3 2 1 1 2 5 2/0 0/- 4/3 7/0 8/2 8/2 11/1 11/2 n vertices - choose n - 1 edges to give tree with a path from source to each vertex that
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.

Page1 / 6

notes06 - CSE 2320 Notes 6: Greedy Algorithms (Last updated...

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

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