The time it takes to run your function, as the size of your input grows. How does the runtime of this function grow?
Check the Big O Notation for each expression, and eventually add them up.
-
Linear Time O(n): Increases almost lineary with the size of the input, i.e. a for loop.
-
Constant Time O(1): Operation always takes the same time, i.e. array look up.
-
Quadratic Time O(n²): Increases as the square of the number of points, i.e. a nested for loop.
-
Polynomial Time O(n^c): Polynomial running is represented as, when
c > 1
. -
Logarithmic Time O(log n): Logarithmic time complexities usually apply to algorithms that divide problems in half every time.
-
Exponential Time O(2^n): Exponential (base 2) running time means that the calculations performed by an algorithm double every time as the input grows.