Data structure

Asymptotic Analysis

Asymptotic Analysis

Asymptotic Analysis is the idea of handling and analyzing the algorithms. In this, we measure the performance of an algorithm in terms of input size. According to the input size, if there is no input then the work is concluded in constant time. Asymptotic analysis of an algorithm refers to defining the mathematical boundation of its run-time performance. Asymptotic analysis refers to computing the running time of any operation in mathematical units of computation. For example, the running time of one operation is computed as f(n), and maybe for another operation it is computed as g(n2). This means the first operation running time will increase linearly with the increase in n and the running time of the second operation will increase exponentially when n increases. Similarly, the running time of both operations will be nearly the same if n is significantly small. Asymptotic analysis computes the running time of operation. The time required by an algorithm comes in three types:

  1. Best case: It is the best case because the time required is minimum in this case.
  2. Average case: In this case, average time is required for the execution of the program.
  3. Worst case: It is called worst-case because maximum time is required for program execution.

            Asymptotic Notation: Asymptotic notation is the way of presenting the best case, average case,                                                                        and worst case in the mathematical format. These are three types of asymptotic notation that are used for showing the run time complexity.

  1. O notation (Big-Oh notation): The big Oh is a formal way to express the upper bound of the running time of an algorithm. It shows the maximum time required to run an algorithm so it shows the worst-case time complexity.

O (g(n)) = f(n) there exist positive constants c and n0 such that 0 

                          <= f(n) <= c*g(n) for all n >= n0}               

  1. Ω Notation (Omega notation): The omega notation is a formal way to express the lower bound                                           of the running time of the algorithm. It tells about the minimum time that is required to complete the task.

              Ω(g(n))= f(n) there exist positive constants c and n0 such that 0 

                            <= c*g(n) <= f(n) for all n >= n0}                                              

         3.Ɵ Notation (Theta Notation): The theta notation is used to present the average bound of the running cases                   of an algorithm.

             Θ(g(n)) = {f(n): there exist positive constants c1, c2 and n0  

                               Such that 0 <= c1*g(n) <= f(n) <= c2*g(n) for all n >= n0}