Complexities


The primary motive to use DSA is to solve a problem effectively and efficiently. How can you decide if a program written by you is efficient or not? This is measured by complexities. Complexity is of two types: Asymptotic notation is a mathematical tool that calculates the required time in terms of input size and does not require the execution of the code. It neglects the system-dependent constants and is related to only the number of modular operations being performed. The following three asymptotic notations are mostly used to represent the time complexity of algorithms:

The above figure shows an example of the rates of growth of algorithms. The most used notation in the analysis of a code is the Big-O notation which gives an upper bound of the running time of the code (or the amount of memory used in terms of input size).

Review: Time Complexity of Algorithms
    Which asymptotic notation is used to represent the best-case scenario of time complexity of algorithms?

      Big-O notation (Ο)
      Omega notation (Ω)
      Theta notation (θ)
      Time notation (T)
        Result:




      The funny thing is when you start feeling happy alone,    
      that’s when everyone decides to be with you.    
      — Jim Carrey