9.1 Algorithmic thinking Flashcards
1.1 What is an algorithm?
A sequence of instructions to solve a problem or achieve a goal.
1.2 What is searching?
Searching is where the programs checks through a list looking to find a piece of data. (E.g. looking for a name in a list.)
1.3 How does a linear search work?
A linear search starts with the first item in the list and checks each one in turn to see if it matches the data being searched for.
1.4 How does a binary search work?
A binary search checks the middle value in the list. If that middle item is higher than the search value it disregards the top half of the list. Then it checks the middle of the remaining values. This process repeats until the value is found, or no data remains.
4.1 Pseudocode definition
Pseudocode is a way to design algorithms. It uses commands which are similar to those in a computer program, but is not as rigid, as it is only intended for planning the steps involved.
4.2 Why won’t pseudocode run on a computer?
Pseudocode is a design tool. Just like you can’t drive the design of a car or live in an architect’s design of a house.
4.3 Trace table definition
A trace table is used to test if an algorithm written in pseudocode works properly.
4.4 Why do you need trace tables?
Because pseudocode is not a working computer program, you cannot run it to test it. Instead you follow the pseudocode, writing down the values it generates and outputs.
2.1 Input
Identifier ß USERINPUT
2.2 Output
OUTPUT “Data” + variable
2.3 Assignment
identifier ß data
2.4 Selection
IF condition THEN
2.5 Count controlled iteration
FOR i ß 1 to 10
2.6 Condition controlled iteration
WHILE condition
2.7 Arithmetic
+ - * /