Zusammenfassung der Ressource
Problem Solving
- Algorithms
- set of step-by-step
instructions to solve
a problem
- For improved efficiency
- Algorithms can be
reused a number of
times
- Sequence,
selection and
iteration
- Sequence
- Selection (if
statements)
- Iteration (Loops)
- Pseudo-Code
- Way to show
an algorithm in
English
- Uses keywords and
commands without
syntax rules of
programming
languages
- Helps developers create a solution in a high level programming language
- Flowcharts
- Algorithms can be
displayed as flow
charts
- Flow chart shapes
- Debugging Algorithms
- Dry Runs
- is a way of running through an
algorithms one step at a time,
looking for inputs, processing
and outputs to identify any
errors within the code
- Trace tables
- This is a visual way of writing
down each variable, input and
output within the algorithm to show an errors
- https://www.bbc.co.uk/education/guides/z8n3d2p/revision/8
- Searching algorithms
- Searching needs to be efficient to find data.
- Linear Search
- https://www.youtube.com/watch?v=TwsgCHYmbbA
- http://www.teach-ict.com/2016/GCSE_Computing/AQA_8520/3_1_fundamentals_of_algorithms/searching/miniweb/pg3.php
- This is a sequential algorithm which start at
the beginning of the list and moves through
one item at a time until it finds a match or
gets to the end of the list
- This is an example of brute force
algorithm as it only uses row
computing power to do the task
- This is not very efficient way of finding the answer
- For the list on the left with 7 items of data the best case would
be the first item there is a match. However the worst case
would be the last item in the list. The average would be 7 + 1 /
2 = 4 item in the list.
- Binary Searches
- https://www.youtube.com/watch?v=T98PIp4omUA
- https://www.bbc.co.uk/education/guides/zywmyrd/revision/5
- For a binary search the data
mush be sorted first into
ascending order. This search
method uses a divide and
conquer method to find
items.
- 1. Select the median
2. Compare it with the
search item 3. If it is lower
than discard the median
and the higher items or if
it is higher than discard
the median and the lower
items. 4. Recalculate the
new median 5. Repeat until
the item has been found
- Comparing linear and binary searches
- Binary searches are more
efficient than a linear search but
the list has to be sorted first
- Decomposition and Abstraction
- Decomposition
- Breaking a problem doing into a list of
sub problems, so that it is easier to solve
a problem.
- Abstraction
- Identify the essential elements that must be included within a program e.g. for a dice throw within a
game you would need to generate a random number between 1 and 6.
- Must also identify, input, outputs and processing needed within a solution
- Sorting algorithms
- Bubble sort
- https://www.youtube.com/watch?v=RT-hUXUWQ2I
- A bubble sort starts at the begging
of the list and compares each value
with the one next to it
- This process is repeats via a Pass until
the list has been sorted into
ascending or descending order
- Merge sort
- https://www.youtube.com/watch?v=Pr2Jf83_kG0
- 1- break the list into 2, then
repeat until you have a list of 1
item
- 2 - reassemble the list in the
same way as you broke it apart,
by comparing each value
putting the flower value first
- 3 - compare the first vale of each
list putting the smaller value first
in the new joint list
- 4 - Combine the list in the same
way to form a sorted list
- https://www.bbc.co.uk/education/guides/z22wwmn/revision/3