An algorithm is a finite, precise procedure that transforms input into output. Good specifications state assumptions and edge cases before implementation. Pseudocode separates logic from language syntax.
read values
set largest to first value
for each remaining value
if value > largest, update largest
output largest
Exercises
Write pseudocode for finding a minimum.
Identify input, output, and constraints for average marks.
Trace your algorithm with empty, one-item, and repeated inputs.
Self-check
What makes a procedure unambiguous?
Why state constraints?
What is tracing?
Self-Check Quiz
1. Must an algorithm terminate?
AnswerYes, an algorithm is expected to finish for valid inputs.
2. What is an output?
AnswerThe result produced by applying the procedure to its input.
Homework
Specify and trace a grade-classification algorithm.
Include boundary and invalid cases.
Explain how tests support confidence.
Sample answerInputs are marks constrained to 0..100; outputs are named categories. Tests include 0, 49, 50, 79, 80, 100, and invalid values. Tracing records state after each decision.