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.

## Building Blocks

### Sequence

A series of instructions that must be completed in order.

### Iteration

Repeating a sequence zero or more times.

### Decision

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.

# Worksheet

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. β

[10/10]

## Exam Style Questions

1. An algorithm is an unambiguous, repeatable set of instructions that can be followed to complete a given task in a finite time. [2/2]
2. May run zero times. (TRUE about iteration) β
3. 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]

[15/15]

ββ