SlideShare a Scribd company logo
2
Most read
6
Most read
11
Most read
Fundamentals of the Analysis of
Algorithmic Efficency
ANALYSIS FAMEWORK
Efficiency of an algorithm can be in terms of time or space.
Thus, checking whether the algorithm is efficient or not means
analyzing the algorithm. There is a systematic approach that has
to be applied for analyzing any given algorithm. This systematic
approach is modelled by a framework called as ANALYSIS
FRAMEWORK.
The efficiency of an algorithm can be decided by measuring the
performance of an algorithm.
Analysis of algorithm is the process of investigation of an
algorithm’s efficiency respect to two resources:
I. Running time
II. Memory space
The reason for selecting these two criteria are
 Simplicity
 Generality
 Speed
 Memory
Time efficiency or time complexity indicates how fast an
algorithm runs.
Space Efficiency or space complexity is the amount of
memory units required by the algorithm including the
memory needed for the i/p & o/p
ANALYSIS OF ALGORITHMS
Analysis of algorithms
Measuring time
complexity
Computing
best,worst and
average case
efficiencies
Measuring Input
size
Measuring running
time
Computing order of
growth of algorihtms
Measuring space
complexity
Space complexity
The amount of memory required by an algorithm to run.
To Compute the space complexity we use two factors: constant and
instance characteristic
S(p) = C + Sp
C – Constant -> space taken by instruction, variable and identifiers
Sp – space dependent upon instance characteristic
For eg: add(a,b)
return a+b
S(p) = C + Sp
S(p)=C+0
a,b occupy one word size then total size come to be 2
Time complexity
The amount of time required by an algorithm to run for
completion.
For instance in multiuser system , executing time depends on
many factors such as:
System load
Number of other programs running
Instruction set used
Speed of underlying hardware
Frequency count is a count denoting number of times of execution
of statement
For eg: Calculating sum of n numbers
For(i=0;i<n;i++)
{
Sum=sum+a[i];
}
Statement Frequency count
i=0 1
i<n N+1
i++ n
Sum=sum+a[i] n
Total 3n+2
Time complexity normally denotes in terms of Oh notation(O).
Hence if we neglect the constants then we get the time complexity to be O(n)
Eg: Matrics addition
For(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
c[i][j]=a[i][j]+b[i][j]
}
}
The frequency count is:
Statement Frequency count
i=0 1
i<n N+1
i++ n
j=0 N * 1 = n
For Initialization
Outer loop of j
j<n N * (n+1) =n2
+ n times
For
Outer loop
j++ n * n = n2
C[i][j]=a[i][j]+b[i][j] n * n = n2
Total 3n2
+4n+2 O(n2
)
Measuring an Input size:
 Efficiency measure of an algorithm is directly proportional to the input size or range
 So an alg efficiency could be measured as a function of n, where n is the parameter
indicating the algorithm i/p size.
 For ex: when multiplying two matrices, the efficiency of an alg depends on the no. of
multiplication performed not on the order of matrices.
 The i/p given may be a square or a non-square matrix.
 Some algortihm require more than one parameter to indicate the size of their i/p
 In such situation, the size is measured by the number of bits in the n’s binary
representation:
B=floor(log2 n+1)
Eg:
Sorting
Naive Algorithm – n2
Best Algorithm – nlogn
Units for measuring Running time
The running time of an alg depends on:
 Speed of a particular computer
 Quality of a program
 Compiler used
To measure the alg efficiency:
Identify the important operation(core logic) of an algorithm.
This operation is called basic operation
So compute the no. of times the basic operation is executed
will give running time
Basic operation mostly will be in inner loop, it is time
consuming
Problem statement Input size Basic operation
Searching a key element from
the list of n elements
List of n elements
Comparison of key with every
element of list
Perform matrix multiplication
The two matrices with order n
x n
Actual multiplication of the
elements in the matrices
Computing GCD of two
numbers
Two numbers Division
Using the formula the computing time can be obtained
T(n)=Cop C(n)
Running time of
basic operation
Execution time of
the basic operation
Number of times the
operation needs to be
executed
Order of growth
Rate of growth of common computing time function
Worst case, Best case and Average
case Efficiency
An Algortihm efficiency is measured as a function of a
parameter indicating the size of the alg’s i/p
But some algortihm for which running time depends in i/p
size and on the particular i/p.
Time space Tradeoff
Time space tradeoff is basically a situation where either a
space efficiency can be achieved at the cost of time or a time
efficiency can be achieved at the cost of memory

More Related Content

PPTX
Complexity analysis in Algorithms
Daffodil International University
 
PPT
Asymptotic notations
Ehtisham Ali
 
PPT
Asymptotic Notation and Complexity
Rajandeep Gill
 
PPT
Asymptotic analysis
Soujanya V
 
PPT
Time complexity.ppt
YekoyeTigabuYeko
 
PPTX
Asymptotic Notations
Rishabh Soni
 
PPT
how to calclute time complexity of algortihm
Sajid Marwat
 
PPT
Asymptotic notation
Dr Shashikant Athawale
 
Complexity analysis in Algorithms
Daffodil International University
 
Asymptotic notations
Ehtisham Ali
 
Asymptotic Notation and Complexity
Rajandeep Gill
 
Asymptotic analysis
Soujanya V
 
Time complexity.ppt
YekoyeTigabuYeko
 
Asymptotic Notations
Rishabh Soni
 
how to calclute time complexity of algortihm
Sajid Marwat
 
Asymptotic notation
Dr Shashikant Athawale
 

What's hot (20)

PPT
Complexity of Algorithm
Muhammad Muzammal
 
PPTX
Performance analysis(Time & Space Complexity)
swapnac12
 
PPTX
Brute force method
priyankabhansali217
 
PDF
Design and analysis of algorithms
Dr Geetha Mohan
 
PPT
DESIGN AND ANALYSIS OF ALGORITHMS
Gayathri Gaayu
 
PPTX
linked list in data structure
shameen khan
 
PPTX
Binary Tree Traversal
Dhrumil Panchal
 
PDF
Algorithms Lecture 1: Introduction to Algorithms
Mohamed Loey
 
PPTX
Notion of an algorithm
Nisha Soms
 
PPTX
Daa unit 1
Abhimanyu Mishra
 
PPTX
15 puzzle problem using branch and bound
Abhishek Singh
 
PPT
program partitioning and scheduling IN Advanced Computer Architecture
Pankaj Kumar Jain
 
PPTX
Asymptotic notations
Nikhil Sharma
 
PDF
Algorithms Lecture 4: Sorting Algorithms I
Mohamed Loey
 
PPTX
Breadth First Search & Depth First Search
Kevin Jadiya
 
PDF
Code optimization in compiler design
Kuppusamy P
 
PPTX
Elements of dynamic programming
Tafhim Islam
 
PPTX
Mathematical Analysis of Non-Recursive Algorithm.
mohanrathod18
 
PPT
Introduction to data structures and Algorithm
Dhaval Kaneria
 
PPTX
Mathematical Analysis of Recursive Algorithm.
mohanrathod18
 
Complexity of Algorithm
Muhammad Muzammal
 
Performance analysis(Time & Space Complexity)
swapnac12
 
Brute force method
priyankabhansali217
 
Design and analysis of algorithms
Dr Geetha Mohan
 
DESIGN AND ANALYSIS OF ALGORITHMS
Gayathri Gaayu
 
linked list in data structure
shameen khan
 
Binary Tree Traversal
Dhrumil Panchal
 
Algorithms Lecture 1: Introduction to Algorithms
Mohamed Loey
 
Notion of an algorithm
Nisha Soms
 
Daa unit 1
Abhimanyu Mishra
 
15 puzzle problem using branch and bound
Abhishek Singh
 
program partitioning and scheduling IN Advanced Computer Architecture
Pankaj Kumar Jain
 
Asymptotic notations
Nikhil Sharma
 
Algorithms Lecture 4: Sorting Algorithms I
Mohamed Loey
 
Breadth First Search & Depth First Search
Kevin Jadiya
 
Code optimization in compiler design
Kuppusamy P
 
Elements of dynamic programming
Tafhim Islam
 
Mathematical Analysis of Non-Recursive Algorithm.
mohanrathod18
 
Introduction to data structures and Algorithm
Dhaval Kaneria
 
Mathematical Analysis of Recursive Algorithm.
mohanrathod18
 
Ad

Similar to Fundamentals of the Analysis of Algorithm Efficiency (20)

PPTX
Analysis of Algorithm full version 2024.pptx
rajesshs31r
 
PPTX
Design Analysis of Alogorithm 1 ppt 2024.pptx
rajesshs31r
 
PDF
Performance Analysis,Time complexity, Asymptotic Notations
DrSMeenakshiSundaram1
 
PPTX
Unit i basic concepts of algorithms
sangeetha s
 
PPTX
Unit 1, ADA.pptx
jinkhatima
 
PPTX
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
AntareepMajumder
 
PPTX
TIME EXECUTION OF DIFFERENT SORTED ALGORITHMS
Tanya Makkar
 
PPTX
Analysis of Algorithms_Under Graduate Class Slide
HanumatGSastry
 
PPT
Introduction to design and analysis of algorithm
DevaKumari Vijay
 
PPTX
Data Structures and Agorithm: DS 22 Analysis of Algorithm.pptx
RashidFaridChishti
 
PPT
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Tekle12
 
PPT
Chapter1.1 Introduction.ppt
Tekle12
 
PPTX
Design and Analysis of Algorithms.pptx
Syed Zaid Irshad
 
PPTX
Algorithm for the DAA agscsnak javausmagagah
RaviPandey598038
 
PDF
Algorithm Analysis.pdf
MemMem25
 
PPTX
Data Structure Algorithm -Algorithm Complexity
zeeshanhaidermazhar7
 
PPTX
02 Introduction to Data Structures & Algorithms.pptx
mettlehenry573
 
PDF
DSA
rrupa2
 
PPTX
Module-1.pptxbdjdhcdbejdjhdbchchchchchjcjcjc
shashashashashank
 
Analysis of Algorithm full version 2024.pptx
rajesshs31r
 
Design Analysis of Alogorithm 1 ppt 2024.pptx
rajesshs31r
 
Performance Analysis,Time complexity, Asymptotic Notations
DrSMeenakshiSundaram1
 
Unit i basic concepts of algorithms
sangeetha s
 
Unit 1, ADA.pptx
jinkhatima
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
AntareepMajumder
 
TIME EXECUTION OF DIFFERENT SORTED ALGORITHMS
Tanya Makkar
 
Analysis of Algorithms_Under Graduate Class Slide
HanumatGSastry
 
Introduction to design and analysis of algorithm
DevaKumari Vijay
 
Data Structures and Agorithm: DS 22 Analysis of Algorithm.pptx
RashidFaridChishti
 
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Tekle12
 
Chapter1.1 Introduction.ppt
Tekle12
 
Design and Analysis of Algorithms.pptx
Syed Zaid Irshad
 
Algorithm for the DAA agscsnak javausmagagah
RaviPandey598038
 
Algorithm Analysis.pdf
MemMem25
 
Data Structure Algorithm -Algorithm Complexity
zeeshanhaidermazhar7
 
02 Introduction to Data Structures & Algorithms.pptx
mettlehenry573
 
DSA
rrupa2
 
Module-1.pptxbdjdhcdbejdjhdbchchchchchjcjcjc
shashashashashank
 
Ad

More from Saranya Natarajan (9)

PPTX
cns unit 1.pptx
Saranya Natarajan
 
PPTX
Asymptotic notation
Saranya Natarajan
 
PPT
mutidimensional database
Saranya Natarajan
 
PPT
ER-Model-ER Diagram
Saranya Natarajan
 
PPTX
embedded-static-&dynamic
Saranya Natarajan
 
PPTX
Query-porcessing-& Query optimization
Saranya Natarajan
 
PPT
concurrency-control
Saranya Natarajan
 
PPTX
deadlock
Saranya Natarajan
 
PPTX
serializability in dbms
Saranya Natarajan
 
cns unit 1.pptx
Saranya Natarajan
 
Asymptotic notation
Saranya Natarajan
 
mutidimensional database
Saranya Natarajan
 
ER-Model-ER Diagram
Saranya Natarajan
 
embedded-static-&dynamic
Saranya Natarajan
 
Query-porcessing-& Query optimization
Saranya Natarajan
 
concurrency-control
Saranya Natarajan
 
serializability in dbms
Saranya Natarajan
 

Recently uploaded (20)

PPTX
Practice Questions on recent development part 1.pptx
JaspalSingh402
 
PPTX
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
PDF
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
PPTX
TE-AI-Unit VI notes using planning model
swatigaikwad6389
 
PDF
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
PDF
Principles of Food Science and Nutritions
Dr. Yogesh Kumar Kosariya
 
PDF
A Framework for Securing Personal Data Shared by Users on the Digital Platforms
ijcncjournal019
 
PDF
6th International Conference on Artificial Intelligence and Machine Learning ...
gerogepatton
 
PPTX
Simulation of electric circuit laws using tinkercad.pptx
VidhyaH3
 
PPTX
Unit 5 BSP.pptxytrrftyyydfyujfttyczcgvcd
ghousebhasha2007
 
PPTX
Edge to Cloud Protocol HTTP WEBSOCKET MQTT-SN MQTT.pptx
dhanashri894551
 
PPTX
Fluid Mechanics, Module 3: Basics of Fluid Mechanics
Dr. Rahul Kumar
 
PDF
Activated Carbon for Water and Wastewater Treatment_ Integration of Adsorptio...
EmilianoRodriguezTll
 
PDF
ETO & MEO Certificate of Competency Questions and Answers
Mahmoud Moghtaderi
 
PDF
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
PPTX
EE3303-EM-I 25.7.25 electrical machines.pptx
Nagen87
 
PPTX
Chapter_Seven_Construction_Reliability_Elective_III_Msc CM
SubashKumarBhattarai
 
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
quakeplayz54
 
PPTX
Module_II_Data_Science_Project_Management.pptx
anshitanarain
 
Practice Questions on recent development part 1.pptx
JaspalSingh402
 
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
TE-AI-Unit VI notes using planning model
swatigaikwad6389
 
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
Principles of Food Science and Nutritions
Dr. Yogesh Kumar Kosariya
 
A Framework for Securing Personal Data Shared by Users on the Digital Platforms
ijcncjournal019
 
6th International Conference on Artificial Intelligence and Machine Learning ...
gerogepatton
 
Simulation of electric circuit laws using tinkercad.pptx
VidhyaH3
 
Unit 5 BSP.pptxytrrftyyydfyujfttyczcgvcd
ghousebhasha2007
 
Edge to Cloud Protocol HTTP WEBSOCKET MQTT-SN MQTT.pptx
dhanashri894551
 
Fluid Mechanics, Module 3: Basics of Fluid Mechanics
Dr. Rahul Kumar
 
Activated Carbon for Water and Wastewater Treatment_ Integration of Adsorptio...
EmilianoRodriguezTll
 
ETO & MEO Certificate of Competency Questions and Answers
Mahmoud Moghtaderi
 
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
EE3303-EM-I 25.7.25 electrical machines.pptx
Nagen87
 
Chapter_Seven_Construction_Reliability_Elective_III_Msc CM
SubashKumarBhattarai
 
Lesson 3_Tessellation.pptx finite Mathematics
quakeplayz54
 
Module_II_Data_Science_Project_Management.pptx
anshitanarain
 

Fundamentals of the Analysis of Algorithm Efficiency

  • 1. Fundamentals of the Analysis of Algorithmic Efficency
  • 2. ANALYSIS FAMEWORK Efficiency of an algorithm can be in terms of time or space. Thus, checking whether the algorithm is efficient or not means analyzing the algorithm. There is a systematic approach that has to be applied for analyzing any given algorithm. This systematic approach is modelled by a framework called as ANALYSIS FRAMEWORK. The efficiency of an algorithm can be decided by measuring the performance of an algorithm.
  • 3. Analysis of algorithm is the process of investigation of an algorithm’s efficiency respect to two resources: I. Running time II. Memory space The reason for selecting these two criteria are  Simplicity  Generality  Speed  Memory
  • 4. Time efficiency or time complexity indicates how fast an algorithm runs. Space Efficiency or space complexity is the amount of memory units required by the algorithm including the memory needed for the i/p & o/p
  • 5. ANALYSIS OF ALGORITHMS Analysis of algorithms Measuring time complexity Computing best,worst and average case efficiencies Measuring Input size Measuring running time Computing order of growth of algorihtms Measuring space complexity
  • 6. Space complexity The amount of memory required by an algorithm to run. To Compute the space complexity we use two factors: constant and instance characteristic S(p) = C + Sp C – Constant -> space taken by instruction, variable and identifiers Sp – space dependent upon instance characteristic For eg: add(a,b) return a+b S(p) = C + Sp S(p)=C+0 a,b occupy one word size then total size come to be 2
  • 7. Time complexity The amount of time required by an algorithm to run for completion. For instance in multiuser system , executing time depends on many factors such as: System load Number of other programs running Instruction set used Speed of underlying hardware Frequency count is a count denoting number of times of execution of statement
  • 8. For eg: Calculating sum of n numbers For(i=0;i<n;i++) { Sum=sum+a[i]; } Statement Frequency count i=0 1 i<n N+1 i++ n Sum=sum+a[i] n Total 3n+2 Time complexity normally denotes in terms of Oh notation(O). Hence if we neglect the constants then we get the time complexity to be O(n)
  • 10. The frequency count is: Statement Frequency count i=0 1 i<n N+1 i++ n j=0 N * 1 = n For Initialization Outer loop of j j<n N * (n+1) =n2 + n times For Outer loop j++ n * n = n2 C[i][j]=a[i][j]+b[i][j] n * n = n2 Total 3n2 +4n+2 O(n2 )
  • 11. Measuring an Input size:  Efficiency measure of an algorithm is directly proportional to the input size or range  So an alg efficiency could be measured as a function of n, where n is the parameter indicating the algorithm i/p size.  For ex: when multiplying two matrices, the efficiency of an alg depends on the no. of multiplication performed not on the order of matrices.  The i/p given may be a square or a non-square matrix.  Some algortihm require more than one parameter to indicate the size of their i/p  In such situation, the size is measured by the number of bits in the n’s binary representation: B=floor(log2 n+1)
  • 12. Eg: Sorting Naive Algorithm – n2 Best Algorithm – nlogn
  • 13. Units for measuring Running time The running time of an alg depends on:  Speed of a particular computer  Quality of a program  Compiler used To measure the alg efficiency: Identify the important operation(core logic) of an algorithm. This operation is called basic operation So compute the no. of times the basic operation is executed will give running time Basic operation mostly will be in inner loop, it is time consuming
  • 14. Problem statement Input size Basic operation Searching a key element from the list of n elements List of n elements Comparison of key with every element of list Perform matrix multiplication The two matrices with order n x n Actual multiplication of the elements in the matrices Computing GCD of two numbers Two numbers Division
  • 15. Using the formula the computing time can be obtained T(n)=Cop C(n) Running time of basic operation Execution time of the basic operation Number of times the operation needs to be executed
  • 17. Rate of growth of common computing time function
  • 18. Worst case, Best case and Average case Efficiency An Algortihm efficiency is measured as a function of a parameter indicating the size of the alg’s i/p But some algortihm for which running time depends in i/p size and on the particular i/p.
  • 19. Time space Tradeoff Time space tradeoff is basically a situation where either a space efficiency can be achieved at the cost of time or a time efficiency can be achieved at the cost of memory