Sign in
Log inSign up

Big O Notation

idris oladoyin's photo
idris oladoyin
·Mar 13, 2021·

1 min read

A more theoretical way of comparing one algorithm to another is called Big O Notation. There are couple of rules with the notation to remember:

  1. Constant are ignored
  2. Smaller components are ignored For Example:

O(500*n) -> O(n), the constant value which is 500 is replaced with 1.

O(999999)->O(1), the constant value which is 999999 is replaced with 1.

O(10*n^2 +5n +20) ->O(n^2), the constant value 10 is replaced with 1 and the added smaller components are ignored.

O(n*n)->O(n^2), no constant or added value.

O(nlog(n) + 30000n)
->O(n*log(n))
, the added smaller components are ignored.

O(1) or {Constant time}: The algorithm is not dependent on a variable dataset i.e regardless of the input size, the runtime of the algorithm will not increase beyond the constant size.

to be continued....