Please enable JavaScript.
Coggle requires JavaScript to display documents.
Algorithm Complexity - Coggle Diagram
Algorithm Complexity
Big O Notation - LINEAR COMPLEXITY
O(N) given to algorithms whose time will will increase in direct proportion to the size of the inputted set of data
Big O Notation - Exponential Complexity
The main issue with this algorithm is the fact that it is trying to find the values recursively.
Each time we try to find the next value, we have to carry out an ever increasing number of calculations.
Big O Notation - CONSTANT COMPLEXITY
O(1) is given to algorithms which will take the same time regardless on how big or small the inputted data set is which will be processed
Big O Notation - POLYNORMAL COMPLEXITY
This matches each item in the list with every other item in the list. For
example, if we gave it an array [1,2,3], we'd get back [(1,1) (1,2), (1,3), (2, 1),
(2, 2), (2, 3), (3, 1), (3, 2), (3, 3)].
This is therefore finding all possible combinations of the values in the array.
This algorithm is considered O(n^2).
This is because every time we add a single item in the list (ie: n I the size of the
input), we have to do n more operations. So n * n == n^2.
Big O Notation - LOGARITHMIC COMPLEXITY
O(log N) algorithms are highly efficient algorithms.
In maths, logarithms are the inverse of powers. We have already seen that with polynomial (or worse) algorithms take an increasing amount of time to execute as their data set increases.
With logarithmic algorithms, the increase in execution time slows down as the data set increase.
This can be demonstrated with the principles of Divide and Conquer from a binary search algorithm.
GOOD Big o Notations
O(n^2)
O(n)
O(1)
O(n^0.5)
O(log n)
Bad Big O notations
O(n^n)
O(n^3)