Lecture 3 - Part 2
Lecture 3 - Part 2
❑ Algorithms
❑ Test data
❑ Validation and verification
❑ Using trace tables
❑ Identifying and correcting errors
❑ Producing algorithms
An ALGORITHM sets out the steps to complete a given task. This is
usually shown as a flowchart or pseudocode.
1. Efficiency
2. Correctness
3. Appropriateness
1. Efficiency
➢ Accuracy : How many decimal places produce output with greater accuracy
(e.g. more decimal places)
➢ Range: Will the algorithm work with the complete range of inputs? Or can
it only deal with positive numbers, whole numbers, numbers below 1
million, etc.
➢ Reliability: Will the algorithm always produce correct output within the
range that it is designed to work? Or are there values which it will not
accept (e.g. zero).
3. Appropriateness
This will require the use of test data and trace tables.
Some tasks are required frequently and there are standard methods
of completing them, for example, taking the square root of a
number or sorting a list of names into alphabetical order.
The set of test data used in the activity above was 7 and 18.
The type of test data used to do this is called NORMAL DATA, this
should be used to work through the solution to find the actual
result(s) and see if these are the same as the expected result(s).
For example, here is a set of normal test data for an algorithm to
record the percentage marks from 10 end-of-term examinations for
a student and find their average mark:
Normal test data: 50, 50, 50, 50, 50, 50 50, 50, 50, 50
Expected result: 50
Testing also needs to be done to prove that the solution does not
give incorrect results.
Extreme data are the largest and smallest values that normal data
can take.