Posts

Showing posts with the label Asymptotic Notations

Types of Algorithm and Its Complexity Analysis

Image
In this post, we will learn types of Algorithm and its time complexity analysis with examples  An algorithm is divided into two forms called iterative and recursive, as shown above. Firstly, we analyze the time complexity of the iterative algorithm and then recursive. Example 1:                           A()                           {                            int i;                            for(i=1 to n)   % loop run n times                         ...

Time Complexity Analysis

Image
In this post, we will do some excise to understand the actual significance of asymptotic notation. How, we will calculate the complexity and what will be the notations. The following series are important before we can begin to calculate the complexity. Linear series (arithmetic series) for n>=0   Quadratic series for n>=0 Cubic series for n>=0   Geometric series for x!=1,         For |x|  Linear Geometric series for n>=0, real c!=1 Harmonic series nth harmonic number The unrolling of the looping statement within the computer programs may resemble with the following series, and we can directly use it to compute the complexity of the scheme.  How to define notations  Normally, the time complexity with worst case analysis is important If the complexity of  Worst case (Big-O) == Best cast (Big-Omega), than we can go with Average case complexity i.e (Big-theta)  If the loops i...