SlideShare a Scribd company logo
6
6
Properties of Algorithm
FINITENESS
 An algorithm must always terminate after a finite number of steps.
 It means after every step one reach closer to solution of the problem
and after a finite number of steps algorithm reaches to an end point.
DEFINITENESS
 Each step of an algorithm must be precisely defined.
 It is done by well thought actions to be performed at each step of
the algorithm.
 Also the actions are defined unambiguously for each activity in the
algorithm.
INPUT
 Any operation you perform need some beginning value/ quantities
associated with different activities in the operation.
 So the value/quantities are given to the algorithm before it begins.
Most read
8
8
Performance of an algorithm depends on
many factors:
• Internal Factors: Specify algorithm’s efficiency in terms of
 Time required to run
 Space (Memory)required to run
• External Factors: affect the algorithm’s performance
 Size of the input to the algorithm
 Speed of computer on which it is run
 Quality of the Computer
Efficiency of Algorithm
Most read
14
14
• Big Ω describes the set of all algorithms that run no better
than a certain speed (it’s a lower bound)
• It measures the best case time complexity or the best amount
of time an algorithm can possibly take to complete.
• Best case performance of an algorithm given function g(n),
we denote by Ω(g(n)) the set of functions.
Ω (g(n)) = {f(n): there exist positive constants c and n0
such that 0 <= c*g(n) <= f(n) for all n >= n0}.
• Best case performance of an algorithm is generally not useful,
the Omega notation is the least used notation among all
three.
Omega Notation - Ω
Most read
ALGORITHMIC EFFICIENCY
Prof. K. Adisesha
BE, M.Sc., M.Th., NET, (Ph.D.)
2
Learning objectives
• Introduction
• Algorithm Definition
• What is computational Complexity
• Estimating Complexity of Algorithm
• Asymptotic Notations
• Complexity of an Algorithm
3
Algorithm
What is an Algorithm?
• An algorithm is a step-by-step procedure for solving a
problem in a finite amount of time.
• The word algorithm comes from the name of a Persian
Mathematician Abu Ja’far Mohammed ibn-I Musa al
Khowarizmi.
• For a given problem:
 There can be more than one solution (more than one
algorithm) .
 An algorithm can be implemented using different
programming languages on different platforms.
4
Algorithm
Designing of an Algorithm
• Design of an algorithm is an area of computer science which
minimizes the cost.
• Always design algorithms which minimize the cost.
Analysis of Algorithm
• Analysis of Algorithms is the area of computer science that
provides tools to analyze the efficiency of different methods
of solutions.
• In short predict the cost of an algorithm in terms of
resources and performance is called analysis of Algorithm.
5
Properties of Algorithm
Donald Ervin Knuth has given a list of five properties for an
algorithm, these properties are:
1. FINITENESS
2. DEFINITENESS
3. INPUT
4. OUTPUT
5. EFFECTIVENESS
6
Properties of Algorithm
FINITENESS
 An algorithm must always terminate after a finite number of steps.
 It means after every step one reach closer to solution of the problem
and after a finite number of steps algorithm reaches to an end point.
DEFINITENESS
 Each step of an algorithm must be precisely defined.
 It is done by well thought actions to be performed at each step of
the algorithm.
 Also the actions are defined unambiguously for each activity in the
algorithm.
INPUT
 Any operation you perform need some beginning value/ quantities
associated with different activities in the operation.
 So the value/quantities are given to the algorithm before it begins.
7
Properties of Algorithm
OUTPUT
 One always expects output/result (expected value/quantities) in
terms of output from an algorithm.
 The result may be obtained at different stages of the algorithm.
 Result is obtained from the intermediate stage of the operation then
it is known as intermediate result
 Result obtained at the end of algorithm is known as end result.
 The output is expected value/quantities always have a specified
relation to the inputs.
EFFECTIVENESS
 Algorithms to be developed/written using basic operations.
 Algorithms operations should be done exactly and in a finite amount
of time by a person, by using paper and pencil only.
8
Performance of an algorithm depends on
many factors:
• Internal Factors: Specify algorithm’s efficiency in terms of
 Time required to run
 Space (Memory)required to run
• External Factors: affect the algorithm’s performance
 Size of the input to the algorithm
 Speed of computer on which it is run
 Quality of the Computer
Efficiency of Algorithm
9
There are two aspects of algorithmic performance or
efficiency:
• TIME COMPLEXITY: It is essentially efficiency, or how long a
program function takes to process a given input.
 Instructions take time.
 How fast does the algorithm perform?
 What affects its runtime?
• SPACE COMPLEXITY: of an algorithm is total space taken by the
algorithm with respect to the input size. Space complexity includes
both Auxiliary space and space used by input.
 Data structures take space
 What kind of data structures can be used?
 How does choice of data structure affect the runtime?
Internal Factors
10
Asymptotic Analysis:
• In Asymptotic Analysis, we evaluate the performance of an
algorithm in terms of input size
• Asymptotic analysis of an algorithm refers to defining the
mathematical framing of its run-time performance.
• Usually, the time required by an algorithm falls under three
types −
 Best Case − Minimum time required for program execution.
 Average Case − Average time required for program execution.
 Worst Case − Maximum time required for program execution.
Asymptotic Analysis
11
Asymptotic Analysis:
• Following are the commonly used asymptotic notations to
calculate the running time complexity of an algorithm.
Asymptotic Analysis
12
Asymptotic Analysis:
• Following graph is commonly used to calculate the running
time complexity of an algorithm.
Asymptotic Analysis
13
• Big O specifically describes the worst-case scenario, and can
be used to describe the execution time required or the space
used (e.g. in memory or on disk) by an algorithm.
• Big O complexity can be visualized with this graph:
Ο Notation ( Big Oh Notation)
14
• Big Ω describes the set of all algorithms that run no better
than a certain speed (it’s a lower bound)
• It measures the best case time complexity or the best amount
of time an algorithm can possibly take to complete.
• Best case performance of an algorithm given function g(n),
we denote by Ω(g(n)) the set of functions.
Ω (g(n)) = {f(n): there exist positive constants c and n0
such that 0 <= c*g(n) <= f(n) for all n >= n0}.
• Best case performance of an algorithm is generally not useful,
the Omega notation is the least used notation among all
three.
Omega Notation - Ω
15
θ notation
• You can use the big-Theta notation to describe the average-case
complexity.
• The θ notation describes asymptotic tight bounds
• If an algorithm has the average-case time complexity of,
say, 3*n^2 - 5n + 13 ,
then it is true that its average-case time complexity is
Theta(n^2) , O(n^2) , and O(n^3)
Theta Notation - θ
16
TIME COMPLEXITY OF SORTING ALGORITHMS
TIME COMPLEXITY OF SEARCHING ALGORITHMS
TIME COMPLEXITY
17
SPACE COMPLEXITY
SPACE COMPLEXITY OF SEARCHING AND SORTING ALGORITHMS
18
• We learned about the Algorithm Definition
• What is computational Complexity
• Estimating Complexity of Algorithm
• Asymptotic Notations
• Complexity of an Algorithm
Thank you
Conclusion!

More Related Content

What's hot (20)

sparse matrix in data structure
sparse matrix in data structuresparse matrix in data structure
sparse matrix in data structure
MAHALAKSHMI P
 
Analysis of algorithm
Analysis of algorithmAnalysis of algorithm
Analysis of algorithm
Rajendra Dangwal
 
Linked List
Linked ListLinked List
Linked List
Ashim Lamichhane
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms I
Mohamed Loey
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm Analysis
Mary Margarat
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
eShikshak
 
Big o notation
Big o notationBig o notation
Big o notation
hamza mushtaq
 
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
Umesh Kumar
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
Protap Mondal
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
karthikeyanC40
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
Gokul Hari
 
Conditional and control statement
Conditional and control statementConditional and control statement
Conditional and control statement
narmadhakin
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Muhammad Hammad Waseem
 
Stack data structure
Stack data structureStack data structure
Stack data structure
Tech_MX
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
Maher Alshammari
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
swapnac12
 
Stack using Array
Stack using ArrayStack using Array
Stack using Array
Sayantan Sur
 
Interface in java
Interface in javaInterface in java
Interface in java
PhD Research Scholar
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data Structures
SHAKOOR AB
 
Stack and Queue
Stack and Queue Stack and Queue
Stack and Queue
Apurbo Datta
 
sparse matrix in data structure
sparse matrix in data structuresparse matrix in data structure
sparse matrix in data structure
MAHALAKSHMI P
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms I
Mohamed Loey
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm Analysis
Mary Margarat
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
eShikshak
 
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
Umesh Kumar
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
Gokul Hari
 
Conditional and control statement
Conditional and control statementConditional and control statement
Conditional and control statement
narmadhakin
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Muhammad Hammad Waseem
 
Stack data structure
Stack data structureStack data structure
Stack data structure
Tech_MX
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
swapnac12
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data Structures
SHAKOOR AB
 

Similar to Python algorithm (20)

Algorithm analysis and design
Algorithm analysis and designAlgorithm analysis and design
Algorithm analysis and design
Megha V
 
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptx
jinkhatima
 
Algorithm in data structure bca .pptx
Algorithm  in  data  structure bca .pptxAlgorithm  in  data  structure bca .pptx
Algorithm in data structure bca .pptx
SukhBanger
 
Modile-1-PPT-1-BCAC0207-AlgorithmDesign.pptx
Modile-1-PPT-1-BCAC0207-AlgorithmDesign.pptxModile-1-PPT-1-BCAC0207-AlgorithmDesign.pptx
Modile-1-PPT-1-BCAC0207-AlgorithmDesign.pptx
ryadavrohit26
 
Introduction to design and analysis of algorithm
Introduction to design and analysis of algorithmIntroduction to design and analysis of algorithm
Introduction to design and analysis of algorithm
DevaKumari Vijay
 
Chapter 09 design and analysis of algorithms
Chapter 09  design and analysis of algorithmsChapter 09  design and analysis of algorithms
Chapter 09 design and analysis of algorithms
Praveen M Jigajinni
 
design analysis of algorithmaa unit 1.pptx
design analysis of algorithmaa unit 1.pptxdesign analysis of algorithmaa unit 1.pptx
design analysis of algorithmaa unit 1.pptx
rajesshs31r
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
MemMem25
 
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx
RahikAhmed1
 
Lec 2 algorithms efficiency complexity
Lec 2 algorithms efficiency  complexityLec 2 algorithms efficiency  complexity
Lec 2 algorithms efficiency complexity
Anaya Zafar
 
Introduction to algorithms
Introduction to algorithmsIntroduction to algorithms
Introduction to algorithms
Madishetty Prathibha
 
Performance Analysis,Time complexity, Asymptotic Notations
Performance Analysis,Time complexity, Asymptotic NotationsPerformance Analysis,Time complexity, Asymptotic Notations
Performance Analysis,Time complexity, Asymptotic Notations
DrSMeenakshiSundaram1
 
DAAMOD12hjsfgi haFIUAFKJNASFQF MNDAF.pdf
DAAMOD12hjsfgi haFIUAFKJNASFQF MNDAF.pdfDAAMOD12hjsfgi haFIUAFKJNASFQF MNDAF.pdf
DAAMOD12hjsfgi haFIUAFKJNASFQF MNDAF.pdf
OnkarSalunkhe5
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
NayanChandak1
 
Unit ii algorithm
Unit   ii algorithmUnit   ii algorithm
Unit ii algorithm
Tribhuvan University
 
daa unit 1.pptx
daa unit 1.pptxdaa unit 1.pptx
daa unit 1.pptx
LakshayYadav46
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
Bulbul Agrawal
 
Algorithm.pptx
Algorithm.pptxAlgorithm.pptx
Algorithm.pptx
Koteswari Kasireddy
 
Algorithm.pptx
Algorithm.pptxAlgorithm.pptx
Algorithm.pptx
Koteswari Kasireddy
 
Design Analysis and Algorithm Module1.pdf
Design Analysis and Algorithm Module1.pdfDesign Analysis and Algorithm Module1.pdf
Design Analysis and Algorithm Module1.pdf
Shana799280
 
Algorithm analysis and design
Algorithm analysis and designAlgorithm analysis and design
Algorithm analysis and design
Megha V
 
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptx
jinkhatima
 
Algorithm in data structure bca .pptx
Algorithm  in  data  structure bca .pptxAlgorithm  in  data  structure bca .pptx
Algorithm in data structure bca .pptx
SukhBanger
 
Modile-1-PPT-1-BCAC0207-AlgorithmDesign.pptx
Modile-1-PPT-1-BCAC0207-AlgorithmDesign.pptxModile-1-PPT-1-BCAC0207-AlgorithmDesign.pptx
Modile-1-PPT-1-BCAC0207-AlgorithmDesign.pptx
ryadavrohit26
 
Introduction to design and analysis of algorithm
Introduction to design and analysis of algorithmIntroduction to design and analysis of algorithm
Introduction to design and analysis of algorithm
DevaKumari Vijay
 
Chapter 09 design and analysis of algorithms
Chapter 09  design and analysis of algorithmsChapter 09  design and analysis of algorithms
Chapter 09 design and analysis of algorithms
Praveen M Jigajinni
 
design analysis of algorithmaa unit 1.pptx
design analysis of algorithmaa unit 1.pptxdesign analysis of algorithmaa unit 1.pptx
design analysis of algorithmaa unit 1.pptx
rajesshs31r
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
MemMem25
 
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx
RahikAhmed1
 
Lec 2 algorithms efficiency complexity
Lec 2 algorithms efficiency  complexityLec 2 algorithms efficiency  complexity
Lec 2 algorithms efficiency complexity
Anaya Zafar
 
Performance Analysis,Time complexity, Asymptotic Notations
Performance Analysis,Time complexity, Asymptotic NotationsPerformance Analysis,Time complexity, Asymptotic Notations
Performance Analysis,Time complexity, Asymptotic Notations
DrSMeenakshiSundaram1
 
DAAMOD12hjsfgi haFIUAFKJNASFQF MNDAF.pdf
DAAMOD12hjsfgi haFIUAFKJNASFQF MNDAF.pdfDAAMOD12hjsfgi haFIUAFKJNASFQF MNDAF.pdf
DAAMOD12hjsfgi haFIUAFKJNASFQF MNDAF.pdf
OnkarSalunkhe5
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
NayanChandak1
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
Bulbul Agrawal
 
Design Analysis and Algorithm Module1.pdf
Design Analysis and Algorithm Module1.pdfDesign Analysis and Algorithm Module1.pdf
Design Analysis and Algorithm Module1.pdf
Shana799280
 
Ad

More from Prof. Dr. K. Adisesha (20)

MACHINE LEARNING Notes by Dr. K. Adisesha
MACHINE LEARNING Notes by Dr. K. AdiseshaMACHINE LEARNING Notes by Dr. K. Adisesha
MACHINE LEARNING Notes by Dr. K. Adisesha
Prof. Dr. K. Adisesha
 
Probabilistic and Stochastic Models Unit-3-Adi.pdf
Probabilistic and Stochastic Models Unit-3-Adi.pdfProbabilistic and Stochastic Models Unit-3-Adi.pdf
Probabilistic and Stochastic Models Unit-3-Adi.pdf
Prof. Dr. K. Adisesha
 
Genetic Algorithm in Machine Learning PPT by-Adi
Genetic Algorithm in Machine Learning PPT by-AdiGenetic Algorithm in Machine Learning PPT by-Adi
Genetic Algorithm in Machine Learning PPT by-Adi
Prof. Dr. K. Adisesha
 
Unsupervised Machine Learning PPT Adi.pdf
Unsupervised Machine Learning PPT Adi.pdfUnsupervised Machine Learning PPT Adi.pdf
Unsupervised Machine Learning PPT Adi.pdf
Prof. Dr. K. Adisesha
 
Supervised Machine Learning PPT by K. Adisesha
Supervised Machine Learning PPT by K. AdiseshaSupervised Machine Learning PPT by K. Adisesha
Supervised Machine Learning PPT by K. Adisesha
Prof. Dr. K. Adisesha
 
Introduction to Machine Learning PPT by K. Adisesha
Introduction to Machine Learning PPT by K. AdiseshaIntroduction to Machine Learning PPT by K. Adisesha
Introduction to Machine Learning PPT by K. Adisesha
Prof. Dr. K. Adisesha
 
Design and Analysis of Algorithms ppt by K. Adi
Design and Analysis of Algorithms ppt by K. AdiDesign and Analysis of Algorithms ppt by K. Adi
Design and Analysis of Algorithms ppt by K. Adi
Prof. Dr. K. Adisesha
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
 
Operating System-4 "File Management" by Adi.pdf
Operating System-4 "File Management" by Adi.pdfOperating System-4 "File Management" by Adi.pdf
Operating System-4 "File Management" by Adi.pdf
Prof. Dr. K. Adisesha
 
Operating System-3 "Memory Management" by Adi.pdf
Operating System-3 "Memory Management" by Adi.pdfOperating System-3 "Memory Management" by Adi.pdf
Operating System-3 "Memory Management" by Adi.pdf
Prof. Dr. K. Adisesha
 
Operating System Concepts Part-1 by_Adi.pdf
Operating System Concepts Part-1 by_Adi.pdfOperating System Concepts Part-1 by_Adi.pdf
Operating System Concepts Part-1 by_Adi.pdf
Prof. Dr. K. Adisesha
 
Operating System-2_Process Managementby_Adi.pdf
Operating System-2_Process Managementby_Adi.pdfOperating System-2_Process Managementby_Adi.pdf
Operating System-2_Process Managementby_Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfSoftware Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfSoftware Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfSoftware Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfSoftware Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfSoftware Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfSoftware Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Prof. Dr. K. Adisesha
 
Computer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaComputer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. Adisesha
Prof. Dr. K. Adisesha
 
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaCCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
Prof. Dr. K. Adisesha
 
MACHINE LEARNING Notes by Dr. K. Adisesha
MACHINE LEARNING Notes by Dr. K. AdiseshaMACHINE LEARNING Notes by Dr. K. Adisesha
MACHINE LEARNING Notes by Dr. K. Adisesha
Prof. Dr. K. Adisesha
 
Probabilistic and Stochastic Models Unit-3-Adi.pdf
Probabilistic and Stochastic Models Unit-3-Adi.pdfProbabilistic and Stochastic Models Unit-3-Adi.pdf
Probabilistic and Stochastic Models Unit-3-Adi.pdf
Prof. Dr. K. Adisesha
 
Genetic Algorithm in Machine Learning PPT by-Adi
Genetic Algorithm in Machine Learning PPT by-AdiGenetic Algorithm in Machine Learning PPT by-Adi
Genetic Algorithm in Machine Learning PPT by-Adi
Prof. Dr. K. Adisesha
 
Unsupervised Machine Learning PPT Adi.pdf
Unsupervised Machine Learning PPT Adi.pdfUnsupervised Machine Learning PPT Adi.pdf
Unsupervised Machine Learning PPT Adi.pdf
Prof. Dr. K. Adisesha
 
Supervised Machine Learning PPT by K. Adisesha
Supervised Machine Learning PPT by K. AdiseshaSupervised Machine Learning PPT by K. Adisesha
Supervised Machine Learning PPT by K. Adisesha
Prof. Dr. K. Adisesha
 
Introduction to Machine Learning PPT by K. Adisesha
Introduction to Machine Learning PPT by K. AdiseshaIntroduction to Machine Learning PPT by K. Adisesha
Introduction to Machine Learning PPT by K. Adisesha
Prof. Dr. K. Adisesha
 
Design and Analysis of Algorithms ppt by K. Adi
Design and Analysis of Algorithms ppt by K. AdiDesign and Analysis of Algorithms ppt by K. Adi
Design and Analysis of Algorithms ppt by K. Adi
Prof. Dr. K. Adisesha
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
 
Operating System-4 "File Management" by Adi.pdf
Operating System-4 "File Management" by Adi.pdfOperating System-4 "File Management" by Adi.pdf
Operating System-4 "File Management" by Adi.pdf
Prof. Dr. K. Adisesha
 
Operating System-3 "Memory Management" by Adi.pdf
Operating System-3 "Memory Management" by Adi.pdfOperating System-3 "Memory Management" by Adi.pdf
Operating System-3 "Memory Management" by Adi.pdf
Prof. Dr. K. Adisesha
 
Operating System Concepts Part-1 by_Adi.pdf
Operating System Concepts Part-1 by_Adi.pdfOperating System Concepts Part-1 by_Adi.pdf
Operating System Concepts Part-1 by_Adi.pdf
Prof. Dr. K. Adisesha
 
Operating System-2_Process Managementby_Adi.pdf
Operating System-2_Process Managementby_Adi.pdfOperating System-2_Process Managementby_Adi.pdf
Operating System-2_Process Managementby_Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfSoftware Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfSoftware Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfSoftware Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfSoftware Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfSoftware Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Prof. Dr. K. Adisesha
 
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfSoftware Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Prof. Dr. K. Adisesha
 
Computer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaComputer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. Adisesha
Prof. Dr. K. Adisesha
 
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaCCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
Prof. Dr. K. Adisesha
 
Ad

Recently uploaded (20)

LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18
Celine George
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
Strengthened Senior High School - Landas Tool Kit.pptx
Strengthened Senior High School - Landas Tool Kit.pptxStrengthened Senior High School - Landas Tool Kit.pptx
Strengthened Senior High School - Landas Tool Kit.pptx
SteffMusniQuiballo
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptxRai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big CycleRay Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
Hemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptxHemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptx
Arshad Shaikh
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdfUnit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
How to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 SalesHow to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 Sales
Celine George
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
Quiz Club of PSG College of Arts & Science
 
Capitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptxCapitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptx
CapitolTechU
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxDiptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
Quiz Club of PSG College of Arts & Science
 
Rose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdfRose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdf
kushallamichhame
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18
Celine George
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
Strengthened Senior High School - Landas Tool Kit.pptx
Strengthened Senior High School - Landas Tool Kit.pptxStrengthened Senior High School - Landas Tool Kit.pptx
Strengthened Senior High School - Landas Tool Kit.pptx
SteffMusniQuiballo
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big CycleRay Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
Hemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptxHemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptx
Arshad Shaikh
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdfUnit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
How to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 SalesHow to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 Sales
Celine George
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
Capitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptxCapitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptx
CapitolTechU
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxDiptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
Rose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdfRose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdf
kushallamichhame
 

Python algorithm

  • 1. ALGORITHMIC EFFICIENCY Prof. K. Adisesha BE, M.Sc., M.Th., NET, (Ph.D.)
  • 2. 2 Learning objectives • Introduction • Algorithm Definition • What is computational Complexity • Estimating Complexity of Algorithm • Asymptotic Notations • Complexity of an Algorithm
  • 3. 3 Algorithm What is an Algorithm? • An algorithm is a step-by-step procedure for solving a problem in a finite amount of time. • The word algorithm comes from the name of a Persian Mathematician Abu Ja’far Mohammed ibn-I Musa al Khowarizmi. • For a given problem:  There can be more than one solution (more than one algorithm) .  An algorithm can be implemented using different programming languages on different platforms.
  • 4. 4 Algorithm Designing of an Algorithm • Design of an algorithm is an area of computer science which minimizes the cost. • Always design algorithms which minimize the cost. Analysis of Algorithm • Analysis of Algorithms is the area of computer science that provides tools to analyze the efficiency of different methods of solutions. • In short predict the cost of an algorithm in terms of resources and performance is called analysis of Algorithm.
  • 5. 5 Properties of Algorithm Donald Ervin Knuth has given a list of five properties for an algorithm, these properties are: 1. FINITENESS 2. DEFINITENESS 3. INPUT 4. OUTPUT 5. EFFECTIVENESS
  • 6. 6 Properties of Algorithm FINITENESS  An algorithm must always terminate after a finite number of steps.  It means after every step one reach closer to solution of the problem and after a finite number of steps algorithm reaches to an end point. DEFINITENESS  Each step of an algorithm must be precisely defined.  It is done by well thought actions to be performed at each step of the algorithm.  Also the actions are defined unambiguously for each activity in the algorithm. INPUT  Any operation you perform need some beginning value/ quantities associated with different activities in the operation.  So the value/quantities are given to the algorithm before it begins.
  • 7. 7 Properties of Algorithm OUTPUT  One always expects output/result (expected value/quantities) in terms of output from an algorithm.  The result may be obtained at different stages of the algorithm.  Result is obtained from the intermediate stage of the operation then it is known as intermediate result  Result obtained at the end of algorithm is known as end result.  The output is expected value/quantities always have a specified relation to the inputs. EFFECTIVENESS  Algorithms to be developed/written using basic operations.  Algorithms operations should be done exactly and in a finite amount of time by a person, by using paper and pencil only.
  • 8. 8 Performance of an algorithm depends on many factors: • Internal Factors: Specify algorithm’s efficiency in terms of  Time required to run  Space (Memory)required to run • External Factors: affect the algorithm’s performance  Size of the input to the algorithm  Speed of computer on which it is run  Quality of the Computer Efficiency of Algorithm
  • 9. 9 There are two aspects of algorithmic performance or efficiency: • TIME COMPLEXITY: It is essentially efficiency, or how long a program function takes to process a given input.  Instructions take time.  How fast does the algorithm perform?  What affects its runtime? • SPACE COMPLEXITY: of an algorithm is total space taken by the algorithm with respect to the input size. Space complexity includes both Auxiliary space and space used by input.  Data structures take space  What kind of data structures can be used?  How does choice of data structure affect the runtime? Internal Factors
  • 10. 10 Asymptotic Analysis: • In Asymptotic Analysis, we evaluate the performance of an algorithm in terms of input size • Asymptotic analysis of an algorithm refers to defining the mathematical framing of its run-time performance. • Usually, the time required by an algorithm falls under three types −  Best Case − Minimum time required for program execution.  Average Case − Average time required for program execution.  Worst Case − Maximum time required for program execution. Asymptotic Analysis
  • 11. 11 Asymptotic Analysis: • Following are the commonly used asymptotic notations to calculate the running time complexity of an algorithm. Asymptotic Analysis
  • 12. 12 Asymptotic Analysis: • Following graph is commonly used to calculate the running time complexity of an algorithm. Asymptotic Analysis
  • 13. 13 • Big O specifically describes the worst-case scenario, and can be used to describe the execution time required or the space used (e.g. in memory or on disk) by an algorithm. • Big O complexity can be visualized with this graph: Ο Notation ( Big Oh Notation)
  • 14. 14 • Big Ω describes the set of all algorithms that run no better than a certain speed (it’s a lower bound) • It measures the best case time complexity or the best amount of time an algorithm can possibly take to complete. • Best case performance of an algorithm given function g(n), we denote by Ω(g(n)) the set of functions. Ω (g(n)) = {f(n): there exist positive constants c and n0 such that 0 <= c*g(n) <= f(n) for all n >= n0}. • Best case performance of an algorithm is generally not useful, the Omega notation is the least used notation among all three. Omega Notation - Ω
  • 15. 15 θ notation • You can use the big-Theta notation to describe the average-case complexity. • The θ notation describes asymptotic tight bounds • If an algorithm has the average-case time complexity of, say, 3*n^2 - 5n + 13 , then it is true that its average-case time complexity is Theta(n^2) , O(n^2) , and O(n^3) Theta Notation - θ
  • 16. 16 TIME COMPLEXITY OF SORTING ALGORITHMS TIME COMPLEXITY OF SEARCHING ALGORITHMS TIME COMPLEXITY
  • 17. 17 SPACE COMPLEXITY SPACE COMPLEXITY OF SEARCHING AND SORTING ALGORITHMS
  • 18. 18 • We learned about the Algorithm Definition • What is computational Complexity • Estimating Complexity of Algorithm • Asymptotic Notations • Complexity of an Algorithm Thank you Conclusion!