Performance analysis of algorithms

Krishnkant Jaiswal
2 min readJan 3, 2021

--

In the software industry algorithm is everything and in general, there is always more than one solution(algorithm) to any given problem.

Since there are many solutions to being a problem solver you have to choose an optimized one. In order to choose a solution, one should be able to measure its performance and put each solution on a single graph. While calculating any parameter always make sure that this parameter is only dependent on the algorithm. There are two popular performance parameters for every algorithm.

1: Time Complexity: This parameter answers “How fast is your algorithm?”.

Suppose you want to sort the list of size n and you called your programmer friends to solve the problem. Everyone gave their own solution. Now you have to decide which will you choose. In the above graph, you have plotted the time taken by each algorithm with respect to the size of the list. Considering the above graph you decide which one will select.

2: Space Complexity: This parameter answers “How much space your algorithm requires?”. Consider the above scenario of sorting the list but now you are plotting the space vs size. Here space is again defined in terms of n means you will be counting on how many copies of data will be created will processing or shorting then while looking at the values you can select a particular algorithm.

Conclusion: In the end, you should be selecting the fastest algorithm with the least memory requirement but sometimes space complexity and time complexity are inversely proportional in this case you have to do the tradeoff and choose the algorithm depending on the system.

--

--

No responses yet