An algorithm is an unambiguous, repeatable set of instructions that can be followed to complete a given task in a finite time.
Programming is the process of converting an algorithm into computer code.
A series of instructions that must be completed in order.
Repeating a sequence zero or more times.
Zero or one sequences that can be chosen from a range of options.
A plan is vital to producing a good program if it has any complexity.
An algorithm is an umabiguous, repeatable set of instructions that can be followed to complete a task in a finite time. [5/5]
Sequence → To carry out a set of instructions in the order that they are given. Decision → To choose between, and perform, zero or one from a range of options. Iteration → Repetition of a sequence of commands zero or more times. [3/3]
Definite iteration: Iterating a set number of times, determinable without executing the algorithm. ☑
Indefinite iteration: Iterating an unset number of times, in programming this is usually shown as a while loop. The loop only ends when a condition is met, not when a task has been performed X times. ☑
Exam Style Questions
- An algorithm is an unambiguous, repeatable set of instructions that can be followed to complete a given task in a finite time. [2/2]
- May run zero times. (TRUE about iteration) ☑
- There are 28 pupils in Miss Green’s class. She would like to award each pupil a house point. What sort of iteration should be used?
Definite iteration would make sense, because we know how many pupils are in the class. In terms of programming, we can use a for loop to assign a house point to each pupil before the loop terminates. This allows us to perform a simple logical operation many times without having to write the logic out 28 different times. [3/3]