Space/Time Complexity Flashcards
Constant Time Complexity
O(1)
The amount of time taken to complete an algorithm is independent from the number of elements inputted
Linear Time Complexity
O(n)
The amount of time taken to complete an algorithm is directly proportional to the number of elements inputted
Polynomial Time Complexity
O(n n)
The amount of time taken to complete an algorithm is directly proportional to the elements inputted to the power of n
For example :
O(n2)
The amount of time taken to complete an algorithm is directly proportional to the square of the elements inputted
Exponential Time Complexity
O(2n)
The amount of time taken to complete an algorithm will double with every additional item
Logarithmic Time Complexity
O(log n)
The time taken to complete an algorithm will increase at a smaller rate as the number of elements inputted
Time Complexity
A measure of the amount of time needed by an algorithm to solve a particular problem of a given input size
Space Complexity
A measure of the amount of memory space needed by an algorithm to solve a particular problem of a given input size
Big O Notation
A way of classifying algorithms based on their complexity by setting an upper bound for the worst case time or space complexity as a mathematical function of input size