Presentation
on
Introduction to Design and
Analysis of Algorithms
BY
GARIMA VERMA (FACULTY OF COMPUTER SC , DEPT- IT)
Contents
Introduction to Algorithm
Algorithm Analysis
Need to Analyze Algorithm Performance
How to Analyze Time Complexity?
Example
Conclusion
Algorithm
An algorithm is a finite step-by-step procedure to achieve
a required result.
An algorithm is a sequence of computational steps that
transform the input into the output.
Algorithm Analysis
There are two ways to analyze the algorithm performance-
1. Space Complexity
2. Time Complexity
Need to Analyze Algorithm
Performance
 Designing algorithm only does not solve the purpose of
good programmer or developer.
 Before implementation it should be analyzed properly so
that maximum throughput can be achieved in minimum
time.
How to Analyze Time
Complexity ?
Generally time taken by the algorithm is depend on the size
of input.
There are two factors need to be analyzed-
1. Input size- no of items.
2. Running time- summation of execution time.
Example-
Problem definition- Find the max among n numbers.
Solution- in general there are two logic possible to solve this
problem.
1. Sort n numbers in descending order and display 1st
number.
2. Compare each number with the 1st
number and exchange each of them
till n numbers.
Algo-1
Let array A[n]- where all numbers are stored Time
For i=1 to n n
for j=1 to n n
if (A[i]<A[j]) 1 but n times
swap(A[i], A[j]) 1 but n times
Display A[1] ------------- max number 1
Total time n(n+2n)+1=3n2
+1=O(n2
)
Algo-2
Let array A[n]- where all numbers are stored Time
max=A[1]
For i=2 to n n
if (A[i]>max) 1 but n times
max=A[i] 1 but n times
Display max ------------- max number 1
Total time n+2n+1=3n+1=O(n)
Conclusion
It is not important to design an algorithm or program, but
the more important is how much resource your algorithm
can save by increasing the response time and throughput……
Thank you

Daa presentation 97

  • 1.
    Presentation on Introduction to Designand Analysis of Algorithms BY GARIMA VERMA (FACULTY OF COMPUTER SC , DEPT- IT)
  • 2.
    Contents Introduction to Algorithm AlgorithmAnalysis Need to Analyze Algorithm Performance How to Analyze Time Complexity? Example Conclusion
  • 3.
    Algorithm An algorithm isa finite step-by-step procedure to achieve a required result. An algorithm is a sequence of computational steps that transform the input into the output.
  • 4.
    Algorithm Analysis There aretwo ways to analyze the algorithm performance- 1. Space Complexity 2. Time Complexity
  • 5.
    Need to AnalyzeAlgorithm Performance  Designing algorithm only does not solve the purpose of good programmer or developer.  Before implementation it should be analyzed properly so that maximum throughput can be achieved in minimum time.
  • 6.
    How to AnalyzeTime Complexity ? Generally time taken by the algorithm is depend on the size of input. There are two factors need to be analyzed- 1. Input size- no of items. 2. Running time- summation of execution time.
  • 7.
    Example- Problem definition- Findthe max among n numbers. Solution- in general there are two logic possible to solve this problem. 1. Sort n numbers in descending order and display 1st number. 2. Compare each number with the 1st number and exchange each of them till n numbers.
  • 8.
    Algo-1 Let array A[n]-where all numbers are stored Time For i=1 to n n for j=1 to n n if (A[i]<A[j]) 1 but n times swap(A[i], A[j]) 1 but n times Display A[1] ------------- max number 1 Total time n(n+2n)+1=3n2 +1=O(n2 )
  • 9.
    Algo-2 Let array A[n]-where all numbers are stored Time max=A[1] For i=2 to n n if (A[i]>max) 1 but n times max=A[i] 1 but n times Display max ------------- max number 1 Total time n+2n+1=3n+1=O(n)
  • 10.
    Conclusion It is notimportant to design an algorithm or program, but the more important is how much resource your algorithm can save by increasing the response time and throughput……
  • 11.