Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Analysis of algorithms
1. CS8451- DESIGN AND
ANALYSIS OF
ALGORITHMS
Prepared By
Ms.P.Jothi Thilaga, AP/CSE
Ramco Institute of Technology
Rajapalayam
2. Why we need to study “ALGORITHMS”?
As programs get complicated, thinking algorithmically
allows us to:
• reason about their correctness and efficiency before
implementing them
• focus on techniques for solving problems
• understand relationship between different
computational problems
3. Algorithms
• The term algorithm originates from the name of the Persian
mathematician “Al Khowarismi”.
• He had presented generic methods for solving certain categories of
problems for the first time in 825 A.D.
• In 300 B.C., the Greek mathematician Euclid design an efficient
algorithm for finding GCD.
4. • In Computer science, an algorithm is a set of
unambiguous instructions to solve a problem. i.e., for
obtaining a required output for any legitimate input in
a finite amount of time.
• Algorithms are used for calculation, data processing
and automated reasoning.
• An algorithm is an effective method expressed as a
finite list of well-defined instructions for calculating a
function.
7. Fundamentals of the Analysis of
Algorithm Efficiency
• Issues:
Time efficiency
Space efficiency
correctness
optimality
• Approaches:
theoretical analysis
empirical analysis
8. Measuring an Input’s size
• Algorithm efficiency is measured in terms of ‘n’
where n is the input size of an algorithm.
• In some cases, more than one parameter is required to
indicate the size of their inputs.
• In this case the size is represented by the ‘n’ bits.
• To measure size by the number b of bits in the n’s
binary representation:
b = floor(log2n)+1
10. Time Complexity
• The execution time depends on,
System load
Number of other programs running
Instruction set used
Speed of underlying hardware
12. Units of measuring running time
T(n)=cop C(n)
• T(n) - running time of basic operation.
• cop - time taken by the basic operation to execute.
• C(n) – Number of times the operation needs to be executed.
13. Example: Sequential Search
• Best Case: 1 comparisons
• Worst Case: ‘n’ key comparisons
• Average Case: (n+1)/2, assume k is in A
14. Amortized Efficiency
• Amortized complexity is defined as the finding the
average running time or operation over a worst case
sequence of operations.
15. Empirical Analysis
1. Understand the experiment's purpose.
2. Decide on the efficiency metric M to be measured
and the measurement unit
3. Decide on characteristics of the input sample
4. Prepare a program implementing the algorithm for
the experimentation.
5. Generate a sample of inputs.
6. Run the algorithm on the sample's inputs and record
the data observed.
7. Analyze the data obtained.
16. THEORETICAL ANALYSIS
• Analyze before program
is written
• Independent of machine
& programming
environment
• Independent of input
instances
• Need mathematical
knowledge
• For lengthy algorithms,
analysis is difficult
EMPIRICALANALYSIS
• Analyze after the program
is written
• Dependent of
programming
Environment
• Depends on input
instances
• Mathematical knowledge
not required
• Length of the program is
immaterial