Dushyant Jodha Dushyant Jodha

To analyze a programming code or algorithm, we must notice that each instruction affects the overall performance of the algorithm and therefore, each instruction must be analyzed separately to analyze overall performance. However, there are some algorithm control structures which are present in each programming code and have a specific asymptotic analysis.

Some Algorithm Control Structures are:

  1. Sequencing
  2. If-then-else
  3. for loop
  4. While loop

1. Sequencing:

Suppose our algorithm consists of two parts A and B. A takes time tA and B takes time tB for computation. The total computation "tA + tB" is according to the sequence rule. According to maximum rule, this computation time is (max (tA,tB)).


Example:

Suppose tA =O (n) and tB = θ (n2). 
Then, the  total computation time can be calculated as

Computation Time = t

A + tB
 = (max (tA,tB)
 = (max (O (n), θ (n2)) = θ (n2)


Dushyant Jodha

Dushyant Jodha Creator

(No description available)

Suggested Creators

Dushyant Jodha