what are the three main principles of computational thinking
abstraction
decomposition
algorithmic thinking
what is abstraction
the process of removing unnecessary details of a problem to focus on the important features to implement in a solution
implementations of abstraction
computer games
users don’t need to know the complex algorithms used to control the NPCs. it is only important to the user they recognise the environment and when they perform an action, they see a response
train maps
travellers don’t need to know the geographical layout of the routes, only that getting on at stop A will eventually transport you to stop B
what is decomposition
the process of breaking down a large problem into a set of smaller problems
benefits of decomposition
smaller problems are easier to solve
each smaller problem can be solved independently of others
smaller problems can be tested independently
smaller problems can be combined to produce a solution to the full problem
describe computer games as an example of decomposition
modern computer games are decomposed to break down the complexity of the problem into more manageable ‘chunks’. for example:
levels - levels can be designed/created independently of other levels
characters - the mechanics of characters in the game can be designed and created by a separate team
landscape - the art team can work on the visual aspects of the game without needing to understand how the game is programmed
what is algorithmic thinking
the process of creating step-by-step instructions in order to produce a solution to a problem
algorithmic thinking requires the use of abstraction and decomposition to identify each individual step
once each step has been identified, a precise set of rules (algorithm) can be created and the problem will be solved
what is a searching algorithm
precise step-by-step instructions that a computer can follow to efficiently locate specific data in massive data sets
conditions for a binary search to be performed on a set of data
the data must be in order.
it can be performed on datasets containing numbers or words.
searching for a word instead of a number is the same process, except comparisons are made based on position in the alphabet instead of numerical size
how to perform a binary search
-identify middle value
-compare to value you are looking for
-if it is the value you are looking for, stop
-else if it is bigger then the one you are looking for, create a new list with the values on the left of the middle value
-if it is smaller than the one you are looking for, create a new list with the values on the right of the middle value
-repeat with the new list
what is a linear search
starts with the first value in a data set and checks every value one at time until all values have been checked
advantages for binary searches
-fast for large datasets
-efficient for repeated searches
disadvantages of binary search
-dataset must be in order
-more complex to implement
advantages for linear search
-works on unsorted datasets
-faster on very small datasets
-simple to understand and implement
disadvantages for linear search
-slow for large datasets
-inefficient, starts at the beginning each time
what are the three common sorting algorithms
how to perform a bubble sort
-compare the first two values in the dataset
-if they are in the wrong order, swap them
-compare the next two values
-repeat step 2 and 3 until you reach the end of the dataset (pass 1)
-if you have made any swaps, repeat from the start
-else if you have not made only swaps, stop - the list is in the correct order
what strategy does a merge sort use
‘divide and conquer’ strategy of dividing a dataset into smaller sub-datasets and merging them back together in the correct order
how to perform a merge sort
how to perform an insertion sort
what shape is a terminator symbol (start/stop)
rectangle with rounded edges
what shape are input/output symbols
rhombus
what shape are process symbols
rectangle
what shape are decision symbols
diamond