How it works
Explaining an algorithm in prose is separately assessed in this course and is a genuine skill.
Describe what a method guarantees, what it assumes, and what it costs, in that order.
Common error
Narrating the code line by line rather than explaining what it accomplishes and why.
Worked example
Example
Claim: a full scan of n elements uses O(n) time
Evidence: exactly n loop iterations
Space: O(1) auxiliary storage
Precondition: input array is availableA technical explanation connects a conclusion with the operation count, assumptions, and resource definition. Auxiliary space excludes the already-supplied input; output storage should be identified when it matters.
Exercises
0.4.1 · Explain
Rewrite "this algorithm is fast" as a precise claim for a loop that visits n elements once.
Show solution
It takes linear time, O(n), under a constant-cost per-element operation model. State whether the claim is worst-case and what counts as input size.
0.4.2 · Explain
Why should a bug report include input, expected output, actual output, and reproduction steps?
Show solution
Those details let another person reproduce the failure and distinguish a program defect from a misunderstanding of the requirement.
