Sequence, Selection and Iteration Sequence A sequence is just the same as an algorithm. A sequence is not written in a specific programing language, but is always written in chronological order (this could be numbered). There is an example of a sequence/algorithm below: First do this 1. Find ‘number 1’ in memory 2. Add 12 to ‘number 1’ 3. Divide total by 2 Next do this 4. Call the total ‘number 2’ 5. Save back in the same file Next do this 6. Close the file 7. This means that the algorithm will be able to run on a sequential CPU. Most normal computers use sequential CPU’s, meaning that they fetch, decode and execute instructions one at a time. Parallel is the opposite of a sequence and means that the CPU carries out multiple instructions at the same time. Selection Selection is similar to a sequence, but includes a decision. This works by creating a decision and if it is true do this, or if it is false do this. This means there is more variation. This means that the next instruction in the sequence depends on whether the condition is true or false. Condition True Carry on from here False Carry on from here Selection can also be written in pseudo-code using the statements: if, then, else and end. This pseudo-code shows how to double a number each time until it reaches 16. If (X > 16) Then Print (X) Else X=X*2 Iteration Iteration is a key part of computer code as it allows the code to loop. This can be very useful as it can save a lot of lines of code. This could be used to program someone walking in a game as instead of writing left one, right one, and left one… you can just write it once and use a loop which will repeat the code until it is programed to end. When using loop, always make sure you program it to end otherwise the program will never end and won’t work. Condition True While condition is true False Carry on from here This is a piece of code for a timer, written in small basic which shows sequence, selection and iteration.