CS252 Algorithms Monday, 3 October 2022 + Office hours today canceled - I'll try to schedule a couple extra hours this week + Questions - Diameter - other? + Interval scheduling - Example: what if we greedily choose earliest start time? - Example: what if we greedily choose shortest interval? + Dijkstra's Algorithm intro + Proof-writing - Some principles - Seek clarity, correctness, persuasiveness - Name things - Embrace mathematical notation--it's designed for this! - Outline, write, evaluate logical flow & clarity, rewrite - Let's do P1.1 - basic strategy - things to name - turn that naming into an algorithm - correctness proof ===== C[k] = count k S[-1] = 0 S[k] = Sum_j=0^k C[j] R[m,n] = Sum_j=m^n C[j] Claim: R[m,n] = S[m] - S[k]