CS252 Algorithms Wednesday, 5 October 2022 + Proof-writing, maybe - 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]