SlideShare a Scribd company logo
ALGORITHM



www.eshikshak.
Introduction to Algorithm
● An algorithm is finite set of steps defining the
  solution of a particular problem.
● It can be expressed in English like language,
  called pseudocode, in programming language
  or in the form of flowchart.




               www.eshikshak.co.in
Characteristics
● Input – There are zero or more values which are
  externally supplied.
● Output – At least one value is produced
● Definiteness – Each step must be clear and
  unambiguous
● Finiteness – If we trace the steps of an
  algorithm, then for all cases, the algorithm must
  terminate after a finite number of steps
● Effectiveness – Each step must be sufficiently
  basic that it can in principal be carried out by a
  person using only paper and pencil
                www.eshikshak.co.in
Algorithm Complexity
● There are basically two aspects of computer
  programming.
  ○ Data Organization (i.e Data & structure)
  ○ Algorithm
● The choice of a particular algorithm depends
  on the following consideration :
  ○ Time Complexity (Performance Requirements)
  ○ Space Complexity (Memory Requirements)



               www.eshikshak.co.in
Space Complexity
● It means the amount of memory, algorithm or
  program needs to run to completion.

● Some of the reasons for studying space
  complexity are
  ○ If a multi user system
  ○ Sufficient memory is available to run the
    program



               www.eshikshak.co.in
Space Complexity (Cont.)
● The space needed by a program consists of
  the following components.
  ○ Instruction Space : Space needed to store the
    executable version of the program
  ○ Data Space : Space needed to store all
    constants, variable values and has further
    following components
     ■ Constants, variables, structured variables like
       array and structure
     ■ Dynamically allocated space


                www.eshikshak.co.in
Space Complexity (Cont.)
● Environmental Stack Space : Space needed
  to store the information needed to resume the
  suspended functions.
  ○ Return Address
  ○ Values of all local variables and the values of
    formal parameters in the function being
    involved.




               www.eshikshak.co.in
Time Complexity
● It means the amount of time it needs to run to
  completion
● Reasons for studying time complexity
  ○ Interested to know in advance that whether a
    program will provide a satisfactory real time
    response
  ○ There may be several possible solutions with
    different time requirements



               www.eshikshak.co.in
Expressing Space and Time
Complexity
● The space and/or time complexity is usually
  expressed in form of the function f(n)
   ○ Where n is the input size for a given instance of the
     problem being solved.
● Expressing space and/ or time complexity as a
  function has following reasons
   ○ We may be interested to predict the rate of growth
     of complexity as the size of problem increases.
   ○ To Compare the complexities of two or more
     algorithm
   ○ Since in modern computers, the memory is not a
     sence constraint, therefore, our analysis of
                 www.eshikshak.co.in
     algorithms will be on the basis of time complexity.
Big ‘O’ Notation
● Big O is a characterization scheme that
  allows to measure properties of algorithms
  such time and space complexity.
● It is useful to set the prerequisites of
  algorithms and to develop and design efficient
  algorithms in terms of time and space
  complexity.




              www.eshikshak.co.in
Categories of Algorithm
● Based on Big O notation, the algorithm can
  be categorized as follows
  ○ Constant time O(1)
  ○ Logarithmic time O(log n)
  ○ Linear time O(n)
  ○ Polynomial time O(nk) (for k > 1)
  ○ Exponentail time O(kn) for k > 1




               www.eshikshak.co.in
Algorithm Analysis
● Different ways or algorithms to solve a
  problem.
● Hence, some of the algorithm may be more
  efficient than the others
● There are different types of time complexities
  which can be analyzed for an algorithm
   ○ Best Case Time Analysis
   ○ Average Case Time Analysis
   ○ Worst Case Time Analysis

               www.eshikshak.co.in
Best Case Time Complexity
● It is a measure of the minimum time that the
  algorithm will require for an input of size ‘n’.
● The running time of many algorithms varies
  not only for the inputs of different sizes but
  also for the different inputs of same size
   ○ Example : Sorting or Searching




                www.eshikshak.co.in
Worst Case Time Complexity
● The worst case time complexity of an
  algorithm is a measure of the maximum time
  that the algorithm will require for an input of
  size ‘n’.

● Example : If ‘n’ input data items are supplied in
  reverse order for any sorting algorithm, the
  algorithm will require n2 operations to perform the
  sort.


                www.eshikshak.co.in
Average Case Time Complexity
● The time that an algorithm will require to
  execute a typical input data of size ‘n’ is
  known as average case time complexity.




               www.eshikshak.co.in

More Related Content

PPT
Introduction to data structures and Algorithm
ODP
Parallel Programming In Java
PDF
[EMNLP2017読み会] Efficient Attention using a Fixed-Size Memory Representation
PPT
Analysis of algo
PPTX
Multi layered perceptron (mlp)
PPT
Al2ed chapter16
PPTX
Compiler in System Programming/Code Optimization techniques in System Program...
PPTX
Introduction to data structures and Algorithm
Parallel Programming In Java
[EMNLP2017読み会] Efficient Attention using a Fixed-Size Memory Representation
Analysis of algo
Multi layered perceptron (mlp)
Al2ed chapter16
Compiler in System Programming/Code Optimization techniques in System Program...

What's hot (6)

PPTX
Speeding Up Sub-Optimal MAPF Algorithms
PDF
Elementary Parallel Algorithms
PDF
Scalable precise-dynamic-datarace-detection-for-structured-parallelism
PPT
Chap12 slides
Speeding Up Sub-Optimal MAPF Algorithms
Elementary Parallel Algorithms
Scalable precise-dynamic-datarace-detection-for-structured-parallelism
Chap12 slides
Ad

Viewers also liked (20)

PPTX
String matching Algorithm by Foysal
PDF
Lecture15 comparisonoftheloopcontrolstructures.ppt
PPT
Mesics lecture 5 input – output in ‘c’
PDF
Lecture21 categoriesof userdefinedfunctions.ppt
PDF
Html phrase tags
PPT
Mesics lecture 3 c – constants and variables
PDF
Lecture 7 relational_and_logical_operators
PDF
Lecture7relationalandlogicaloperators 110823181038-phpapp02
PPT
Mesics lecture files in 'c'
PPT
Mesics lecture 7 iteration and repetitive executions
PPT
Mesics lecture 8 arrays in 'c'
PDF
Unit 1.3 types of cloud
PDF
Unit 1.1 introduction to cloud computing
PDF
01 Analysis of Algorithms: Introduction
PDF
Algorithm chapter 11
PDF
Unit 1.2 move to cloud computing
PDF
Lecture19 unionsin c.ppt
PDF
Html text and formatting
PPT
Linked list
PPT
Mesics lecture 4 c operators and experssions
String matching Algorithm by Foysal
Lecture15 comparisonoftheloopcontrolstructures.ppt
Mesics lecture 5 input – output in ‘c’
Lecture21 categoriesof userdefinedfunctions.ppt
Html phrase tags
Mesics lecture 3 c – constants and variables
Lecture 7 relational_and_logical_operators
Lecture7relationalandlogicaloperators 110823181038-phpapp02
Mesics lecture files in 'c'
Mesics lecture 7 iteration and repetitive executions
Mesics lecture 8 arrays in 'c'
Unit 1.3 types of cloud
Unit 1.1 introduction to cloud computing
01 Analysis of Algorithms: Introduction
Algorithm chapter 11
Unit 1.2 move to cloud computing
Lecture19 unionsin c.ppt
Html text and formatting
Linked list
Mesics lecture 4 c operators and experssions
Ad

Similar to Algorithm (20)

PPTX
Modile-1-PPT-1-BCAC0207-AlgorithmDesign.pptx
PPT
ALGORITHM-ANALYSIS.ppt
PPTX
Unit 1, ADA.pptx
PPTX
Analysis of Algorithms_Under Graduate Class Slide
PPTX
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
PDF
DSA
PDF
Analysis of Algorithms
PDF
Design & Analysis of Algorithms Lecture Notes
PDF
Algorithms.pdf
PDF
DAAMOD12hjsfgi haFIUAFKJNASFQF MNDAF.pdf
PPTX
Analysis of algorithn class 2
PPTX
Algorithm Introduction
PPTX
Design and Analysis of Algorithms.pptx
PPTX
Module-1.pptxbdjdhcdbejdjhdbchchchchchjcjcjc
PPTX
TIME EXECUTION OF DIFFERENT SORTED ALGORITHMS
PPTX
BCSE202Lkkljkljkbbbnbnghghjghghghghghghghgh
PPT
Chapter 2 ds
PPTX
2. Introduction to Algorithm.pptx
PPTX
Chapter one Department Computer Science
Modile-1-PPT-1-BCAC0207-AlgorithmDesign.pptx
ALGORITHM-ANALYSIS.ppt
Unit 1, ADA.pptx
Analysis of Algorithms_Under Graduate Class Slide
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
DSA
Analysis of Algorithms
Design & Analysis of Algorithms Lecture Notes
Algorithms.pdf
DAAMOD12hjsfgi haFIUAFKJNASFQF MNDAF.pdf
Analysis of algorithn class 2
Algorithm Introduction
Design and Analysis of Algorithms.pptx
Module-1.pptxbdjdhcdbejdjhdbchchchchchjcjcjc
TIME EXECUTION OF DIFFERENT SORTED ALGORITHMS
BCSE202Lkkljkljkbbbnbnghghjghghghghghghghgh
Chapter 2 ds
2. Introduction to Algorithm.pptx
Chapter one Department Computer Science

More from eShikshak (16)

PDF
Modelling and evaluation
PDF
Operators in python
PDF
Datatypes in python
PDF
Introduction to python
PPT
Introduction to e commerce
PDF
Chapeter 2 introduction to cloud computing
PDF
Unit 1.4 working of cloud computing
PPT
Mesics lecture 6 control statement = if -else if__else
PPT
Mesics lecture 5 input – output in ‘c’
PDF
Lecture20 user definedfunctions.ppt
PDF
Lecture18 structurein c.ppt
PDF
Lecture17 arrays.ppt
PDF
Lecture13 control statementswitch.ppt
PDF
Lecturer23 pointersin c.ppt
PDF
Program development cyle
PDF
Language processors
Modelling and evaluation
Operators in python
Datatypes in python
Introduction to python
Introduction to e commerce
Chapeter 2 introduction to cloud computing
Unit 1.4 working of cloud computing
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 5 input – output in ‘c’
Lecture20 user definedfunctions.ppt
Lecture18 structurein c.ppt
Lecture17 arrays.ppt
Lecture13 control statementswitch.ppt
Lecturer23 pointersin c.ppt
Program development cyle
Language processors

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Approach and Philosophy of On baking technology
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
cuic standard and advanced reporting.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Big Data Technologies - Introduction.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Encapsulation_ Review paper, used for researhc scholars
PPT
Teaching material agriculture food technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
Per capita expenditure prediction using model stacking based on satellite ima...
NewMind AI Monthly Chronicles - July 2025
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Approach and Philosophy of On baking technology
Spectral efficient network and resource selection model in 5G networks
cuic standard and advanced reporting.pdf
The AUB Centre for AI in Media Proposal.docx
Big Data Technologies - Introduction.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Unlocking AI with Model Context Protocol (MCP)
Dropbox Q2 2025 Financial Results & Investor Presentation
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Advanced methodologies resolving dimensionality complications for autism neur...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Encapsulation_ Review paper, used for researhc scholars
Teaching material agriculture food technology
Diabetes mellitus diagnosis method based random forest with bat algorithm

Algorithm

  • 2. Introduction to Algorithm ● An algorithm is finite set of steps defining the solution of a particular problem. ● It can be expressed in English like language, called pseudocode, in programming language or in the form of flowchart. www.eshikshak.co.in
  • 3. Characteristics ● Input – There are zero or more values which are externally supplied. ● Output – At least one value is produced ● Definiteness – Each step must be clear and unambiguous ● Finiteness – If we trace the steps of an algorithm, then for all cases, the algorithm must terminate after a finite number of steps ● Effectiveness – Each step must be sufficiently basic that it can in principal be carried out by a person using only paper and pencil www.eshikshak.co.in
  • 4. Algorithm Complexity ● There are basically two aspects of computer programming. ○ Data Organization (i.e Data & structure) ○ Algorithm ● The choice of a particular algorithm depends on the following consideration : ○ Time Complexity (Performance Requirements) ○ Space Complexity (Memory Requirements) www.eshikshak.co.in
  • 5. Space Complexity ● It means the amount of memory, algorithm or program needs to run to completion. ● Some of the reasons for studying space complexity are ○ If a multi user system ○ Sufficient memory is available to run the program www.eshikshak.co.in
  • 6. Space Complexity (Cont.) ● The space needed by a program consists of the following components. ○ Instruction Space : Space needed to store the executable version of the program ○ Data Space : Space needed to store all constants, variable values and has further following components ■ Constants, variables, structured variables like array and structure ■ Dynamically allocated space www.eshikshak.co.in
  • 7. Space Complexity (Cont.) ● Environmental Stack Space : Space needed to store the information needed to resume the suspended functions. ○ Return Address ○ Values of all local variables and the values of formal parameters in the function being involved. www.eshikshak.co.in
  • 8. Time Complexity ● It means the amount of time it needs to run to completion ● Reasons for studying time complexity ○ Interested to know in advance that whether a program will provide a satisfactory real time response ○ There may be several possible solutions with different time requirements www.eshikshak.co.in
  • 9. Expressing Space and Time Complexity ● The space and/or time complexity is usually expressed in form of the function f(n) ○ Where n is the input size for a given instance of the problem being solved. ● Expressing space and/ or time complexity as a function has following reasons ○ We may be interested to predict the rate of growth of complexity as the size of problem increases. ○ To Compare the complexities of two or more algorithm ○ Since in modern computers, the memory is not a sence constraint, therefore, our analysis of www.eshikshak.co.in algorithms will be on the basis of time complexity.
  • 10. Big ‘O’ Notation ● Big O is a characterization scheme that allows to measure properties of algorithms such time and space complexity. ● It is useful to set the prerequisites of algorithms and to develop and design efficient algorithms in terms of time and space complexity. www.eshikshak.co.in
  • 11. Categories of Algorithm ● Based on Big O notation, the algorithm can be categorized as follows ○ Constant time O(1) ○ Logarithmic time O(log n) ○ Linear time O(n) ○ Polynomial time O(nk) (for k > 1) ○ Exponentail time O(kn) for k > 1 www.eshikshak.co.in
  • 12. Algorithm Analysis ● Different ways or algorithms to solve a problem. ● Hence, some of the algorithm may be more efficient than the others ● There are different types of time complexities which can be analyzed for an algorithm ○ Best Case Time Analysis ○ Average Case Time Analysis ○ Worst Case Time Analysis www.eshikshak.co.in
  • 13. Best Case Time Complexity ● It is a measure of the minimum time that the algorithm will require for an input of size ‘n’. ● The running time of many algorithms varies not only for the inputs of different sizes but also for the different inputs of same size ○ Example : Sorting or Searching www.eshikshak.co.in
  • 14. Worst Case Time Complexity ● The worst case time complexity of an algorithm is a measure of the maximum time that the algorithm will require for an input of size ‘n’. ● Example : If ‘n’ input data items are supplied in reverse order for any sorting algorithm, the algorithm will require n2 operations to perform the sort. www.eshikshak.co.in
  • 15. Average Case Time Complexity ● The time that an algorithm will require to execute a typical input data of size ‘n’ is known as average case time complexity. www.eshikshak.co.in