SlideShare a Scribd company logo
ALGORITHM
Dr. Chandan Kumar
Assistant Professor, Computer Science & Engineering Department
Invertis University, Bareilly
Definition
 An algorithm is an effective manner for solving a problem
using finite set of instructions.
 Algorithms are used for calculation, data processing and
automated reasoning.
 Each algorithm is a list of well defined instructions for
computing a task starting from an initial step, the instruction
describe a computation that process through a well defined
series of successive steps, termination in a final step.
Criteria of algorithm
There are five important criteria of writing algorithm.
 Input- It may accept Zero (0) or more inputs.
 Output- It should produce at least one output.
 Definiteness- Each instruction must be clear, well
defined and precise.
 Finiteness- It should be a sequence of finite
instructions.
 Effectiveness- This means that the operation must
be simple and carried out in a finite
time at one or more levels of
complexity.
Notation for Algorithm
 Name of the algorithm- It specify the problem to be solved.
 Step number- Identification tag of an instruction and it is an
unsigned positive number.
 Comment- It follows the step number and describes the
operation. It should be written within a pair of square
brackets. It is optional.
 Termination- It specifies end of algorithm. It is generally a
STOP statement and the last instruction in the algorithm.
Types of Algorithms
 Dynamic Programming Algorithm- This algorithm remembers
older results and attempts to use this to speed the process of finding
new results.
 Greedy Algorithm- This algorithm attempts not only to find a
solution but to find the ideal solution to any given problem.
 Brute Force Algorithm- This approach starts at some random point
and iterates through every possibility until it finds the solution.
 Divide and Conquer Algorithm- This algorithm is similar to a
branch and bound algorithm but the difference is to uses the back
tracking method.
Problem statement
 Find the average of four numbers.
Solution: To solve this problem you need to follow these steps:
 Identify the inputs and outputs.
 Identify any other data and constants required to solve the
problem.
 Identify what needs to be computed
 Write an algorithm to depict the logic.
Solution
 Algorithm: Average of four numbers.
 Step 1: [Read the value of four numbers]
Read num1, num2, num3, num4
 Step 2: [Compute the sum of numbers]
sum=num1+num2+num3+num4
 Step 3: [Compute average]
average=sum/4
 Step 4: [Print the value of average]
Write average
 Step 5: [End of algorithm]
END/STOP
Let us analyse this algorithm
 Read” and “Write” are input and output operations.
 Num1, num2, num3 and num4 are the input to the algorithm.
 Average is the output of the algorithm.
 Other than inputs and outputs, ‘sum’ and constant ‘4’ are also
used.
Patterns in Algorithms
Patterns in Algorithms
 Computer scientists have defined three constructs for a
structured program or algorithm. The idea is that a program
must be made of a combination of only these three constructs:
sequence
decision (selection)
repetition
 It has been proven there is no need for any other constructs.
Using only these constructs makes a program or an algorithm
easy to understand, debug or change.
Patterns in Algorithms
 Sequence: The first construct is called the sequence. An
algorithm, and eventually a program, is a sequence of
instructions, which can be a simple instruction or either of the
other two constructs.
 Decision: Some problems cannot be solved with only a
sequence of simple instructions. Sometimes we need to test a
condition. If the result of testing is true, we follow a sequence
of instructions: if it is false, we follow a different sequence of
instructions. This is called the decision (selection) construct.
Patterns in Algorithms
 Repetition: In some problems, the same sequence of
instructions must be repeated. We handle this with the
repetition or loop construct. Finding the largest integer among
a set of integers can use a construct of this kind.
Algorithm

More Related Content

PPTX
Algorithm - Introduction
PPTX
Architecture Algorithm Definition
PDF
Lecture Note-2: Performance analysis of Algorithms
PPT
03 algorithm properties
PPTX
Algorithm and flowchart2010
PPTX
Algorithm
PPSX
Ic lecture6 architecture and algo
PPTX
Algorithm and flowchart with pseudo code
Algorithm - Introduction
Architecture Algorithm Definition
Lecture Note-2: Performance analysis of Algorithms
03 algorithm properties
Algorithm and flowchart2010
Algorithm
Ic lecture6 architecture and algo
Algorithm and flowchart with pseudo code

What's hot (20)

PPT
Problem solving using Computer
PPTX
Algorithm and pseudocode conventions
PPT
Data structures & problem solving unit 1 ppt
PPT
Introduction to problem solving in c++
PPTX
Algorithm & flowchart
PPT
Algorithm Design
PPT
algorithm
PPTX
Algorithm and flowchart
PPTX
Introduction to problem solving in C
PPT
Fundamental of Algorithms
PPTX
Algorithm and Flowcharts
PPT
Problem Solving Techniques
PPTX
Algorithms
PPS
Data Structure
PDF
Algorithmic problem solving
PPT
Programming aids- Algorithm, Flowchart, Pseudocodes and Decision table
PPT
Class 7 lecture notes
PPT
PPT
L01 intro-daa - ppt1
PDF
As Level Computer Science Book -2
Problem solving using Computer
Algorithm and pseudocode conventions
Data structures & problem solving unit 1 ppt
Introduction to problem solving in c++
Algorithm & flowchart
Algorithm Design
algorithm
Algorithm and flowchart
Introduction to problem solving in C
Fundamental of Algorithms
Algorithm and Flowcharts
Problem Solving Techniques
Algorithms
Data Structure
Algorithmic problem solving
Programming aids- Algorithm, Flowchart, Pseudocodes and Decision table
Class 7 lecture notes
L01 intro-daa - ppt1
As Level Computer Science Book -2
Ad

Similar to "A short and knowledgeable concept about Algorithm " (20)

DOCX
Algorithm - A set of rules for solving operations
PDF
Algorithms notes 2 tutorials duniya
PPTX
Design and analysis of algorithms Module-I.pptx
PDF
GE8151 notes pdf.pdf
PPTX
UNIT 1.pptx
PPTX
01 Introduction to analysis of Algorithms.pptx
PPT
Types of Algorithms.ppt
PPSX
Design and Analysis of Algorithms ppt by K. Adi
PPTX
Chapter #1 (Introduction To Algorithms).pptx
PPTX
daa18d8d-d333-4398-94dd-a46802d88d79.pptx
PDF
2-Algorithms and Complexit data structurey.pdf
PDF
DAA INTRO.pdf of design analysis algorithms
PDF
Basics of Algorithm Unit 1 part 1 algorithm
PPTX
CH-1.1 Introduction (1).pptx
PPTX
2-Algorithms and Complexity analysis.pptx
PDF
1.1 the introduction of design and analysis of algorithm
PPTX
Algorithm.pptx
PDF
Algorithm Analysis.pdf
PPTX
problem solving and algorithm development
PDF
Introduction to data structure
Algorithm - A set of rules for solving operations
Algorithms notes 2 tutorials duniya
Design and analysis of algorithms Module-I.pptx
GE8151 notes pdf.pdf
UNIT 1.pptx
01 Introduction to analysis of Algorithms.pptx
Types of Algorithms.ppt
Design and Analysis of Algorithms ppt by K. Adi
Chapter #1 (Introduction To Algorithms).pptx
daa18d8d-d333-4398-94dd-a46802d88d79.pptx
2-Algorithms and Complexit data structurey.pdf
DAA INTRO.pdf of design analysis algorithms
Basics of Algorithm Unit 1 part 1 algorithm
CH-1.1 Introduction (1).pptx
2-Algorithms and Complexity analysis.pptx
1.1 the introduction of design and analysis of algorithm
Algorithm.pptx
Algorithm Analysis.pdf
problem solving and algorithm development
Introduction to data structure
Ad

More from CHANDAN KUMAR (13)

PPTX
Chart and graphs in R programming language
PPTX
Raid technology
PPTX
Pointers in c
PPT
Sorting algorithms
PPT
Searching in c language
PPT
Greedy algorithm
PPT
Divide and conquer algorithm
PPTX
Arrays in c
PPTX
Loops in c programming
PPT
Linked List
PPTX
Stack and queue
PPTX
Technical questions for interview c programming
PPT
Decision making using if statement
Chart and graphs in R programming language
Raid technology
Pointers in c
Sorting algorithms
Searching in c language
Greedy algorithm
Divide and conquer algorithm
Arrays in c
Loops in c programming
Linked List
Stack and queue
Technical questions for interview c programming
Decision making using if statement

Recently uploaded (20)

PDF
Well-logging-methods_new................
PPTX
additive manufacturing of ss316l using mig welding
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
Geodesy 1.pptx...............................................
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
UNIT 4 Total Quality Management .pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Digital Logic Computer Design lecture notes
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Sustainable Sites - Green Building Construction
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
web development for engineering and engineering
PPTX
Internet of Things (IOT) - A guide to understanding
Well-logging-methods_new................
additive manufacturing of ss316l using mig welding
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Geodesy 1.pptx...............................................
bas. eng. economics group 4 presentation 1.pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
UNIT 4 Total Quality Management .pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Digital Logic Computer Design lecture notes
Foundation to blockchain - A guide to Blockchain Tech
Embodied AI: Ushering in the Next Era of Intelligent Systems
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Sustainable Sites - Green Building Construction
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Model Code of Practice - Construction Work - 21102022 .pdf
Lecture Notes Electrical Wiring System Components
web development for engineering and engineering
Internet of Things (IOT) - A guide to understanding

"A short and knowledgeable concept about Algorithm "

  • 1. ALGORITHM Dr. Chandan Kumar Assistant Professor, Computer Science & Engineering Department Invertis University, Bareilly
  • 2. Definition  An algorithm is an effective manner for solving a problem using finite set of instructions.  Algorithms are used for calculation, data processing and automated reasoning.  Each algorithm is a list of well defined instructions for computing a task starting from an initial step, the instruction describe a computation that process through a well defined series of successive steps, termination in a final step.
  • 3. Criteria of algorithm There are five important criteria of writing algorithm.  Input- It may accept Zero (0) or more inputs.  Output- It should produce at least one output.  Definiteness- Each instruction must be clear, well defined and precise.  Finiteness- It should be a sequence of finite instructions.  Effectiveness- This means that the operation must be simple and carried out in a finite time at one or more levels of complexity.
  • 4. Notation for Algorithm  Name of the algorithm- It specify the problem to be solved.  Step number- Identification tag of an instruction and it is an unsigned positive number.  Comment- It follows the step number and describes the operation. It should be written within a pair of square brackets. It is optional.  Termination- It specifies end of algorithm. It is generally a STOP statement and the last instruction in the algorithm.
  • 5. Types of Algorithms  Dynamic Programming Algorithm- This algorithm remembers older results and attempts to use this to speed the process of finding new results.  Greedy Algorithm- This algorithm attempts not only to find a solution but to find the ideal solution to any given problem.  Brute Force Algorithm- This approach starts at some random point and iterates through every possibility until it finds the solution.  Divide and Conquer Algorithm- This algorithm is similar to a branch and bound algorithm but the difference is to uses the back tracking method.
  • 6. Problem statement  Find the average of four numbers. Solution: To solve this problem you need to follow these steps:  Identify the inputs and outputs.  Identify any other data and constants required to solve the problem.  Identify what needs to be computed  Write an algorithm to depict the logic.
  • 7. Solution  Algorithm: Average of four numbers.  Step 1: [Read the value of four numbers] Read num1, num2, num3, num4  Step 2: [Compute the sum of numbers] sum=num1+num2+num3+num4  Step 3: [Compute average] average=sum/4  Step 4: [Print the value of average] Write average  Step 5: [End of algorithm] END/STOP
  • 8. Let us analyse this algorithm  Read” and “Write” are input and output operations.  Num1, num2, num3 and num4 are the input to the algorithm.  Average is the output of the algorithm.  Other than inputs and outputs, ‘sum’ and constant ‘4’ are also used.
  • 10. Patterns in Algorithms  Computer scientists have defined three constructs for a structured program or algorithm. The idea is that a program must be made of a combination of only these three constructs: sequence decision (selection) repetition  It has been proven there is no need for any other constructs. Using only these constructs makes a program or an algorithm easy to understand, debug or change.
  • 11. Patterns in Algorithms  Sequence: The first construct is called the sequence. An algorithm, and eventually a program, is a sequence of instructions, which can be a simple instruction or either of the other two constructs.  Decision: Some problems cannot be solved with only a sequence of simple instructions. Sometimes we need to test a condition. If the result of testing is true, we follow a sequence of instructions: if it is false, we follow a different sequence of instructions. This is called the decision (selection) construct.
  • 12. Patterns in Algorithms  Repetition: In some problems, the same sequence of instructions must be repeated. We handle this with the repetition or loop construct. Finding the largest integer among a set of integers can use a construct of this kind.