Because of the regularity with which these processes occur in different problems, they are known as standard algorithms. Each of the following 5 algorithms covered on the next few pages would typically be implemented as a function or procedure.
Input Validation (Nat 5 algorithm)
Input validation is used to ensure that the user enters only data that is acceptable i.e. in a suitable format and within the limits of the data required for processing.
Example in Pseudocode
Example in Python
Finding Maximum and Finding Minimum
These algorithms are most typically used when processing a list of data items in an array, for example finding the highest and lowest temperatures in some weather data or the fastest finisher in a cycling event from timing chip data recorded.
The algorithms are obviously very similar since they use the same process.
Example in Pseudocode – Finding Maximum
It is generally more useful to return the position of the maximum or minimum value rather than the value itself, especially when there is associated data like names and so on stored in parallel arrays or arrays of records.
Example in Python Finding Maximum
Example in Pseudocode – Finding Minimum
Example in Python- Finding Minimum