CS252 Algorithms Monday, 20 May 2024 + Exam prep - See Layla's guide - Topics - Divide and conquer - Solving recurrences - Master Theorem - Find pattern & prove by induction - Dynamic programming - the general process - wire cutting - knapsack - Bellman-Ford - Network flows - what's a flow? - Ford-Fulkerson - cuts & network flows - Asymptotics, as in Exams 1 & 2 - definitions of O, Ω, and ϴ - simple arguments from definitions - e.g. problem 2 from exam 2 - know runtimes of data structures and algs we have studied + Network flows (concepts & mechanisms today and W; peek at applications F) - water metaphor (capacity = liters/sec) - given an example network, how much water can you let through each pipe per second to maximize the flow at the sink t without overwhelming any of the junctions? - directed graph G, so (u,v) means an edge u -> v - edge capacities c_e / c_{uv} where e = (u,v) - source (s) & sink (t) - f: E -> R^{>=0}, f(e) <= c_e - f_in(v) = sum_{e = (u,v) in E} f(e) - f_out(v) = sum_{e = (v,u) in E} f(e) - a "flow" is a function f as above, where - f_in(v) = f_out(v) for every v != s or t - f_in(s) = 0 = f_out(t) (true because there are no in-edges at s or out-edges at t) - 0 <= f(e) <= c_e for every edge e - the "value of a flow" = sum_{e = (s,u) in E} f(e) - REMEMBER: c_e is not the same thing as f(e) 0 <= f(e) <= c_e, and f has some extra properties ---- how to compute all this? ---- - augmenting path in G - residual graph G_f - augmenting path in G_f - how would you find an augmenting path? - s-t cuts - min cut = max flow