What is an algorithm?
A process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer
What are some examples of computational algorithms? (3)
What kind of problems are solved by Algorithms? (6)
What are the properties of a good algorithm? (5)
What is a good basic measure of Efficiency?
The number of assignment statements
What is a Linear Function?
A function that takes the form of f(n) = an + b where a and b are constants
What is a Quadratic Function?
A function that takes the form of f(n) = an^2 +bn + c where a, b and c are constants
What is a Logarithmic Function?
A function that takes the form of f(n) = alog2n (that’s a little low 2)
What is the Logarithm of a number?
The power to which the base must be raised to make it equal to the number
What is Big-O Notation?
A measure of the time complexity of an algorithm. It is a useful approximation of the time taken to execute an algorithm for a given number of items in a data set
How does an algorithm of time complexity O(n) increase?
Linearly
e.g. 10,000 items will take approximately twice as long as 5,000 items to process
How does a Divide and Conquer Algorithm work?
It halves the size of the problem at each pass
What is a Permutation?
A permutation of n items is the number of ways the n items can be arranged
What are the types of Permutation? (2)
What is Big-O notation used for?
Describing the time complexity of different algorithms
What happens in a Linear Search?
Each item is checked one after another until the desired item is found
What is the worst case scenario of a Linear Search?
Every item is checked
What happens in a Binary Search? (4)
What do Binary Trees do?
Hold items in a way that can be searched quickly and easily
What must be true for a Binary Search to take place?
The list must be sorted
What is the time complexity for a Binary Search and Binary Tree?
O(log n)
What is the time complexity for a Linear Search?
O(n)
When is a Bubble Sort best used?
When there are only a small number of items
What happens in a Bubble Sort?
n-1 passes are made through the array, with each adjacent item being compared with the adjacent item and swapped if necessary