Parameters to Analyze the Algorithm

To Analyze an algorithm ,we generally focus on the Time Complexity and Space Complexity, but another factors are also here like Memory, Developer,Effort,Cost of Maintenance etc.

Running Time Analysis

This is the process of determining how the processing time increases with the size of the problem (input Size) increase. The input size is the number of elements in the input and depends on the problem Type, the input can be of different types. The following are common input types.

  • Size of an array
  • Polynomial degree
  • Number of elements in a matrix
  • Number of bits in the binary representation of the input
  • Vertices and edges in a graph.

Running Time Analysis can be measure on the basis of the following Factors.
Execution Time : This is not a good approach to determine the Running Time of an algorithm.
Number of Executed Statement: Its also not a good way to finding the Running Time of an Analysis.
Mathematical Method: In this method ,we express an function f(n) of input size n. This Method is independent from the programming Style, machine Time and also Machine Type.
Example:

Parameters to Analyze the Algorithm
Program in C.

for above program,Total Time Complexity will be

Parameters to Analyze the Algorithm
Here c is constant Value, and we also take highest
rate of growth.

Space Analysis

The space complexity of an algorithm or computer program is the amount of storage space needed to solve the computational problem instance that features the input problem. It is the memory required for the algorithm to execute the program in the system and produce output.

In many places, the term “space complexity” is misused for auxiliary spaces. The following is the correct definition of auxiliary space and space complexity.

Auxiliary space is extra space or temporary space used by the algorithm. The space complexity of an algorithm is the total space occupied by the algorithm relative to the input size. Space complexity includes auxiliary space and space used by input.

Space Complexity = Auxiliary Space + Input space

In Space Analysis, We also follow the Mathematical Method similarly in Running Time Analysis.

2 thoughts on “Parameters to Analyze the Algorithm”

Leave a Reply

Your email address will not be published. Required fields are marked *