Time Complexity of Big O Notation : 02

The time complexity of Big O notation:

There are many time complexity of Big O notation:

  • Constant complexity: O(1)
  • Linear complexity: O(n)
  • Quadratic complexity: O(n2)
  • Exponential complexity: O(2n)
  • Logarithmic complexity: O(log n)


Explanation:

Constant complexity: O(1)

The runtime of an algorithm or a task won’t change no matter what the input size is. To complete a task or an algorithm only one step is required. We can say that the algorithm or task runs in O(1) time. Its order of magnitude is always 1.




Post a Comment

Previous Post Next Post