2.1 Algorithms Flashcards
What is an algorithm?
A sequence of logical instructions for carrying out a task.
What is a program?
A sequence of instructions for a computer.
What is abstraction?
Ignoring unnecessary detail in a problem in order to focus on the important and relevant information.
What is computational thinking?
Solving problems logically, in a way that can be understood by humans and computers.
What is decomposition?
Breaking a complex problem down into smaller sub problems to make it easier to solve
What is sequence?
The order in which the steps are executed.
What is pattern recognition?
Finding similarities and patterns in order to solve complex problems more efficiently.
What is selection?
Decision making that decides which path the algorithm will take next.
What is iteration?
Repeating steps.
What is definite iteration?
Repeating steps a set number of times.
eg for loops
What is a linear search?
Goes through data one by one to find the required item
+ Works with an unordered list
- Slower/less efficient than other searching algorithms
What is a binary search?
Compares the required item to middle of the list, discards the irrelevant half of the list, repeats until the required item is found
+ Fast/efficient
- Only works in an ordered list
- Only works with numbers
What is a bubble sort?
Looks at the first pair of data, swaps them round if in the wrong order, repeats with next pair
+ Doesn’t use much memory
- Doesn’t cope well with large lists
- Slower/less efficient than merge sort
What is a merge sort?
“Divide and conquer” method, splits list in half and half again until lists contain only one value, merges small lists back together in the right order.
+ Quick/efficient
- Uses more memory than other sorting algorithms
What is an insertion sort?
Looks at the second item in the list, compares it to all the items before it, repeats with the next item
+ Doesn’t use much memory
- Doesn’t cope well with large lists