Paper 1: 3.1 Fundamentals of algorithms Flashcards
What is an algorithm?
A set of rules followed by a computer to solve a problem
A computer program is the implementation of an _________
Algorithm
What is abstraction?
Getting rid of unnecessary detail
What shape is an input/output in an algorithm?
Rhombus
What shape is a start/end in an algorithm?
Rectangle with semi circle on each end
What is the shape of a process in an algorithm?
Rectangle
What is the shape of a decision is an algorithm?
Diamond
What is the purpose of an algorithm?
To solve a problem
How do you compare the efficiency of an algorithm?
The shorter algorithm is better if they solve the same problem
How does linear search work?
It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched
How does binary search work?
Chops the list in half, if it is bigger it gets rid of the other side and repeats until the value is found (must be in order)
How does merge sort work?
You split up the list and put it back together in order (merging it)
How does bubble sort work?
Look at the first two, check if they’re in the right order. If not, swap them. Repeat with other pairs until it is fully sorted.