2.1 - Algorithms Flashcards
What is an algorithm?
A sequence of steps that can be followed to complete a task
What is algorithmic thinking?
Following logical steps to solve a problem
What is abstraction?
Ignoring unnecessary information to simplify a problem
What is decomposition?
Breaking down a problem into smaller tasks so it is easier to solve
In a flowchart what represents start/stop terminators?
A ‘squircle’ (square-circle) ▢
In a flowchart what represents subroutines?
A rectangle with a vertical line either side
In a flowchart what is represents the direction of flow?
An arrow
In a flowchart what represents an input or output?
A parallelogram
In a flowchart what represents a process?
A rectangle
In a flowchart what is used to represent a decision?
A diamond with two branches (yes and no)
How do you use a trace table?
- Go through every line
- Only add to a column when that column’s value changes
- (Generally) move onto a new row when you move into a new ‘block’ in the code
- Gaps are fine
What is a linear search?
Compares each item one by one until the target is found or the end of the list is reached
What are the advantages of using a linear search?
- No need for the list to be in order
- Quick process for short lists
What is the disadvantage of using a linear search?
Long process for long lists
What is a binary search?
- Compares middle item to the target
- Discards half of the list which the target can’t be in
- Finds the next middle item and repeats until the target is found/runs out of items