Standard Algorithms
A Standard Algorithm is a set of instructions which is used to solve a problem which is common within code.
An example of a Standard Algorithm and its use is Input Validation. Input Validation prevents users entering incorrect or ‘invalid’ data. It does this using the same four lines of code.
Regardless of the program or the programs purpose, Input Validation looks the same each time, making it a standard algorithm.
Key Points
Standard Algorithms are a repeated sets of instructions that solve a common problem.
There are three you must know.
- Input Validation – Stop users entering invalid data
- Running Total – Loop multiple times and increase or decrease a variable
- Traversing a 1D Array – Loop through an array using the data at each index