Construct and justify algorithms
A specification, an executable process and a correctness argument have different jobs
- Input and output Define the domain, index origin, empty-input policy, required order and handling of repeats
- Accumulation Initialise outside the loop. Count with +1, sum with +x, filter by appending
- Invariant and end state Explain the meaning of the accumulated state after every processed prefix, and why it gives the required result at the end
- Implementation and testing Translate loop bounds and remainder operations carefully. Compare actual output with independently predicted boundary cases; passing tests are evidence, not general proof
Worked example
Sum entries at least 6 in [6, −4, 6, 0, 9], preserving repeated contributions
- \(\displaystyle \text{total}\leftarrow0\)Initialise once
- \(\displaystyle \text{total}:6,6,12,12,21\)After each visit, add x only when x ≥ 6.
- \(\displaystyle \text{output}=21\)Output after the loop. Both 6s contribute
Common mistakes
Difficulty levels
Questions about this topic
Does choosing a complete pseudocode option prove I can write one?+
No. It checks recognition of the supplied design. Independent construction, execution in your chosen tool and justification are separate ungraded work
Can the builder run any program I type?+
No. It executes only its bounded list-processing blocks. Use your own calculator or programming tool for independent implementation
Do many passing tests prove correctness?+
They provide evidence for those inputs. A general argument must also explain why every permitted input is handled and why the process terminates
Can I use a calculator?+
The graded practice questions are set without a calculator. Use a calculator or programming tool for the ungraded implementation tasks
Which year level and chapter is this?+
Year 11, VCE Units 1 & 2, Specialist Mathematics, chapter 3: Logic and algorithms