Tutorials

Motivation of Design and Analysis of Algorithm

Papri Ghosh
16 May 2018
Read Time : 10 Minutes
Motivation of Design and Analysis of Algorithm

Algorithm is a set of mathematical instructions or rules that helps to calculate a solution to a problem. Now the main thing is what a “Problem” is. You may find out any problem in any discipline. This article gives a small example which gives you a clear idea of identifying an algorithm with its proper solution.

Sample Problem: Find out the GCD of two numbers.

Solution-1:

Numbers: 24 and 20.
20 = 2 X 2 X 5
24 = 2 X 2 X 2 X 3
GCD = 2X2 = 4
Step Count = 9

Solution-2:

Numbers: 24 and 20.
24 % 20 = 4
20 % 4 = 0
GCD = 4
Step Count = 2

So, it can be said that the solution 2 is an optimum solution that takes minimum amount of time to produce result. A problem may have more than two solutions, but the motivation of Algorithm is to find out the optimum solution of a problem.

Hope this lecture gives a clear idea of this subject. In the next lecture we will discuss about the complexities.