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....

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct