a set of instructions that instruct a computer system
a good algorithm will have pre-conditions which illustrate what resources are required to perform the instructions, in terms of processing power or additional files
flowchart symbols
A) start/stop
B) input/output
C) subroutine
D) process
E) decision
F) connector
pseudocode
a simple way of describing a set of instructions in a manner that resembles a programming language
decomposition
breaking a problem down into smaller tasks
abstraction
the process of filtering out the characteristics of problems that are not needed in order to concentrate on those that are needed
data structures are used in programming to store data - there are two main types:
arrays
record
arrays:
consist of a single row containing integers, just like a single row of a table
use place value in terms of naming each value in the list (this is called indexing)
the first integer in the array is 'index 0', the second integer is 'index 1', etc.
record:
contains fields to stor data in, in the same way as a database
groups together related data fields
in python, dictionaries are used as records
sort algorithm
used to sort data in an array in ascending or descending order
search algorithms
used to retrieve data based on search criteria
linear simply means working through a sequence in order, so therefore the linear search algorithm will search for an integer by comparing the search integer to each integer in an array
the binary search algorithm can only be used with sorted arrays
binary search algorithm works by:
starting at the middle integer and initially identifying whether this matches the criteria
in many cases it wont , and if this is the case the algorithm will continue
next the program will workout whether the values in the array are sorted in ascending (smallest to largest) or descending (largest to smallest) order
it will then disregard the half which will not contain the criteria
the algorithm will then identify the matching criteria, at this point it is quicker than the linear search algorithm as the integers in the array are ordered
bubble sort algorithm
works by comparing each integer in the list, or 'array', to the next integer in the list, working from left to right
the merge sort algorithm works in a similar way to the bubble sort algorithm, except in a more efficient way as the ‘problem’ is broken down into smaller ‘problems'