CS252 Algorithms Wednesday, 15 May 2024 + Questions? + Coming up - Not going to discuss 6.6 in class (also, not on test) It's just a really important application of DP - Shortest paths allowing negative edge weights Bellman-Ford algorithm, section 6.8 - Next week, intro to Network Flows Very simple NF stuff on exam, but no homework on NF - Somewhere in there, I'm going to tell you a cool story about why the Internet had to be rebooted in 1980 (related to shortest paths and network packet routing) and why sometimes, we really should be proving our algorithms correct + Lists of DP problems - search "dynamic programming problems" e.g. https://leetcode.com/tag/dynamic-programming/ - pick a problem - develop a parameterized sub-problem F(.) that includes a solution to the problem (or from which a solution can be easily derived) - come up with a recurrence for F(.) - build the table for F from the bottom up - Examples - Minimum edit distance - Longest palindromic substring - ... + Divide-and-conquer: counting inversions - K&T section 5.3 - motivation of inversion-counting - what's an inversion? - obvious D&C approach - but what goes wrong? - fix it