2.1 Workbook
2.1 Workbook
1 | Algorithms
Name:
Resources
PG Online text book page ref: 66-88
CraignDave videos for SLR 2.1
GCSE Unit 2.1 | Algorithms
Abstraction
Abstraction means:
Example of an abstraction:
Abstraction
Cat: Cat icon: Necessary features of the icon: Unnecessary features of the icon:
Dog: Dog icon: Necessary features of the icon: Unnecessary features of the icon:
Rabbit: Rabbit icon: Necessary features of the icon: Unnecessary features of the icon:
GCSE Unit 2.1 | Algorithms
Abstraction
A computer program that outputs whether a capital city in Europe is north or south of another capital city in Europe only needs to know the latitude of the two
cities. The other detail is unnecessary. This is an example of abstraction: including the necessary detail and not including the unnecessary detail.
Dublin 53.3498
London 51.5074
Oslo 59.9139
Paris 48.8566
Madrid 40.4168
Program:
GCSE Unit 2.1 | Algorithms
Decomposition
Decomposition means:
Decomposition
Red beads
Chain
Purple beads
GCSE Unit 2.1 | Algorithms
Algorithmic thinking
Program:
GCSE Unit 2.1 | Algorithms
Algorithmic thinking
Linear search
Pseudocode of the linear book = ["Archaeology", "Art", "Biology", "Chemistry", "Computing", "English",
search algorithm: "French", "Geography", "History", "Maths", "Psychology"]
GCSE Unit 2.1 | Algorithms
Binary search
In most cases, the quicker search is performed by the: algorithm. However, this is not true if the first item in the list is the one you want to find.
If the item you want to find is first in the list then the algorithm would be quicker.
GCSE Unit 2.1 | Algorithms
Binary search
Pseudocode of the binary book = ["Archaeology", "Art", "Biology", "Chemistry", "Computing", "English",
search algorithm: "French", "Geography", "History", "Maths", "Psychology"]
found = False
left = 0
right = LEN(book)-1
find = "Geography"
GCSE Unit 2.1 | Algorithms
Bubble sort
How a bubble sort works: Note how 32 has “bubbled” to the top. The algorithm has been optimised so it does not check the
This is how the bubble sort got its name. numbers already bubbled to the top. It can also stop if no
swaps are made after all the numbers are checked.
24 32
8 24
16 16
2 8
32 2
Check 2 Check 32 Check 32 Check 32 Check 2 Check 16 Check 16 Check 2 Check 8 Check 2
and 32. and 16. and 8. and 24. and 16. and 8. and 24. and 8. and 16. and 8.
Swap Swap. Swap. Swap. No swap. Swap. No swap. No swap. No swap. No swap.
GCSE Unit 2.1 | Algorithms
Merge sort
82
43
27
38
Original list. Split list until Swap number Merge adjacent Until all lists are
lists have 2 pairs if lists together. merged.
numbers. necessary.
GCSE Unit 2.1 | Algorithms
Merge sort
24
16
32
Original Split into Swap numbers Merge adjacent lists together Merge adjacent lists together
list. adjacent sub- if necessary in by comparing the first number by comparing the first number
lists of up to two each sub list. in each list, moving the in each list, moving the
numbers. 8 and 16 swap. smaller number into a new smaller number into a new
list, one number at a time. list, one number at a time.
GCSE Unit 2.1 | Algorithms
Insertion sort
24
Yellow dotted box:
unsorted data in the list:
16
32
Line
GCSE Unit 2.1 | Algorithms
1. Play game
2. Change character
3. Quit
Feedback
Breadth Depth Understanding
Some aspects complete Basic level of depth shown Some work is accurate
Little work complete Little depth and detail provided Little work is accurate
I can explain why abstraction is helpful when we are designing a solution to a problem.
I can explain how to produce pseudocode to describe an algorithm and why it is needed.