Big O Notation

  • Runtime Complexity :

  1. What is Big O Notation?

    Big O Notation are used to describe the performance of an algorithm and Scalability of the algorithm.

    means does the algorithm is going to scale well as the input grows really large like billions - trillions paramaters


  1. Notation list

    • O(1) : CONSTANT

    • O(n) : LINEAR
      (for loops performing array operations)

    • O(n^2) || O(n x 2) : QUADRATIC
      (2 loops (Nested) for loops performing array operations)*
      note : if more then 2 or more loops (nested) are there then it wil increment to (n ^ number of loops)

    • O(log n) : LOGARATHMIC
      note : So if any alogo runs in logarthmic time that means that algorithm is more scalable

    • O(2^n) : EXPONENTIAL
      note : So if any alogo runs in logarthmic time that means that algorithm is more scalable

5 importatnt and common Big-O-Notations


  • Space Complexity :

  1. What is Space Complexity?

    • Space complexity, similar to Big O Notation for runtime complexity,Space Complexity describes the memory usage of an algorithm in relation to its input size.

    • It essentially tells you how well the algorithm scales in terms of memory requirements as the input data grows massive billions or trillions of parameters.

NOTE : The notations above is also used for Space Complexity also.