Computational thinking
Structuring problems in a way that computers can easily follow
Decomposition
Breaking a problem down into smaller subproblems
Abstraction
Removing or hiding unnecessary details from a problem so that important details can be focused on or more easily understood
Algorithmic thinking
Deciding on the order that instructions are carried out and identifying decisions that need to be made by the computer
Structure diagram
Graphical method of decomposing a problem
-each layer breaks down layer above it into smaller and smaller sub-problems
-root and node
Flowchart
Graphical representation of an algorithm
-line
-process
-subprogram
-input/ output
-decision
-terminal
Flowchart symbols - line, process, subprogram, input/output, decision, terminal
Line - arrow
Process - rectangle
Subprogram - rectangle with two lines
Input/ output - parallelogram
Decision - diamond
Terminal (start/end) - rounded rectangle
Trace table
Tool used to follow each line of an algorithm through step by step
-show contents of each variable after each line has been carried out and any output
Standard searching algorithms
-linear search
-binary search
Linear search
Inspecting each item of the list in turn to check if it is the desired value
-when value is matching, item is found. If not, next item is checked
-inefficient
-works on unsorted data
Binary search
-discard middle value
-more efficient
-only works on sorted list
Standard sorting algorithms
-bubble sort
-merge sort
-insertion sort
Bubble sort
Insertion sort
Splits the list to be sorted in two parts: sorted side and unsorted side
1. Initially, sorted side contains first item in a list, everything else on the unsorted side
2. first item from unsorted list is inserted to sorted list
3. Repeat until unsorted list has no values
-more efficient
-tricky to code
Merge sort
-more efficient - sorts large list of random values in a quicker time
-not best for nearly sorted or small lists
-divide and conquer