Algorithm reasoning: invariants, termination and cost
Specify state transitions, discover sufficient invariants, prove total correctness and derive operation costs with integer rounding. Compare finite traces with proofs that cover every allowed input.
Open any lesson. Completion records participation; automatic practice checks and human judgment of written arguments are separate. This unit retains its own versioned requirements.
Readiness and preparation
Check your starting point
Try these short questions on paper, then compare your reasoning. They are optional self-checks, not a placement score or a navigation requirement. Use a targeted review when useful and return with your browser’s Back control.
Does an invariant imply that a process stops?
Safety and progress are separate proof obligations.
Compare reasoning and find a refresher
No. A transition that leaves the entire state unchanged preserves every state invariant but can repeat forever. Termination needs a separate argument such as strict descent in a well-founded order.
Operation counts require an explicit cost model and fixed constants.
Compare reasoning and find a refresher
For nonnegative costs, f(n)=O(g(n)) means f(n)≤C g(n) for all n≥n₀ with fixed C and n₀. It does not state elapsed seconds, exact equality or a lower bound.