What are the two categories that algorithms are analysed on?
Is big O the most efficient, average efficiency or least efficient case of an algorithm.
Represents the worst case (least efficient).
What is the most efficient algorithm complexity (give an example).
O(1)
E.g. Hash tables
State the order of efficiency from most to least efficient.
O(1) - constant time
O(logn) - logarithmic time
O(n) - linear time
O(nlogn ) - Quasilinear time
O(n^2) - quadratic time
O(2^n) - exponential time
O(n!) - factorial time
What is the least efficient type of algorithm complexity (give an example)
Factorial time O(n!)
E.g. the heap
Give an example of an algorithm that has quasilinear time complexity. And why is this the case?
O(nlogn)
Mergesort
Because for each item in the list the list must be split
Give an example of an algorithm with time quadratic time complexity. And why is this the case?
O(n^2)
Bubble sort
Because the program loops through all list positions then for each list position loops through them all again