Big-O Notation
"Big-O" notation is a way of describing how efficient an algorithm is, or its "order". It is written in the form O(maths)
with the maths describing how the time the algorithm takes increases as the size of the input increases.
Common O-notations
O(1)
: Constant - The algorithm will take the same amount of time no matter how large the input is
O(log(n))
: Logarithmic - The bigger the input, the slower the time taken grows (e.g. input goes from 1-2, takes twice as long, input goes from 100-200, still takes twice as long)
O(n^2)
: Quadratic - If the input is doubled, the time taken is squared