CS252 Algorithms Monday, 31 October 2022 (Boo!) + Homework/testing plan - Topics left: dynamic programming & network flows - Tools for giving you practice - problem sets - takehome exam - in-class exam - final project (study algorithm of your choice, make a video, implement, write a paper...) - 3 weeks to end of finals - Option 1 - PS on dynamic programming - PS on network flows - Takehome final (comprehensive) - Option 2 - PS on DP & NF - Project (pick and algorithm, report, & implement) - No exam ===== Wire-cutting (often called "rod-cutting") Given - A price p[j] you can charge for a piece of wire of length j, for j = 1,...,m Goal - Maximum revenue you can earn by cutting up (or not) a piece of wire of length n <= m - (Secondary goal: where should I make the cuts?) Play around - Do a small example - Mess with the small example and boundary cases - What does brute-force look like? Decompose recursively - Does it work? - Complexity? Build up subproblem solutions - Top-down (memoized) - Bottom-up (dynamic programming) - Complexity? Backtracing - Retrieving the cuts that maximize revenue - (Dijkstra: get the paths, not just the distances) - (BFS: get the paths, don't just visit everybody) - (...)