SlideShare a Scribd company logo
Design and Analysis of Algorithm
1
Muhammad ibn Musaal -
Khwarizmi
Father of Algorithm
2
Definition:
An algorithm is a finite set of instructions that accomplishes a
particular
task.
All algorithms must satisfy the following criteria.
Characteristics:
1. Input : Zero or more quantities are externally supplied.
2. Output : At least one quantity is produced.
3. Definiteness : Each instruction is clear and unambiguous.
Statements such as “add 6 or 7 to x” is not permitted”
4. Finiteness : The algorithm should terminate after a finite number of steps.
5. Effectiveness : Instruction is basic enough to be carried out.
Algorithms that are effective and definite are called computational procedures.
Example : The operating system of a digital computer.
To achieve the criterion of definiteness algorithm are written in a programming
language.
A program is the expression of an algorithm in a programming language.
Areas for the study of algorithms:
1. How to devise an algorithm
2. How to validate an algorithm
3. How to analyze an algorithm
4. How to test a program
▪ Debugging
▪ Profiling
1. How to devise an algorithm
To design new algorithm, we apply a existing design strategy.
Some of the existing strategies are
Divide and Conquer
Greedy Method
Dynamic Programming
Back Tracking
Branch and Bound etc.
2. How to validate an algorithm
To check whether the algorithm giving correct output or not for all
possible inputs.
3. How to analyze an algorithm
Based on performance measures such as space and time
i) How much time required
ii) How much space required
4. How to test a program
▪ Debugging
▪ Profiling
Debugging is a process of executing program on sample data sets, to
determine whether any fault results occur. If so correct them.
Profiling is a process of executing a correct program on sample data sets and
determine how much time/space required by program
Representation and Structure of an Algorithm:
We can describe an algorithm in many ways.
We can use a natural language like English, but if we select this option,
we must make sure that the resulting instructions are definite.
Graphic representations called flow charts are another possibility, but
they work well only if the algorithm is small and simple.
We can also represent algorithms using pseudo code that resemble C
and Pascal.
We present most of our algorithms using pseudo code that resembles C
and Pascal.
1. Comments begin with // and continue until end of the line.
2. Blocks are indicated with matching braces: { and }.
i. A compound statement
ii. Body of a procedure.
3.
i. An identifier begins with a letter.
ii. The data types of variables are not explicitly declared.
iii. The types will be clear from the context.
iv. Whether a variable is global or local to a procedure will also be
evident
from the context.
v. We assume simple data types such as integer, float, char, boolean,
and so on.
9
4. Assignment of values to variables is done using the assignment
statement.
< variable > := < expression >
5. There are two boolean values true and false. To produce these values,
logical operators and, or and not and the relational operators <, ≤,=, ≠,
≥
and > are provided.
6. Elements of multidimensional arrays are accessed using [ and ]. For
example the (i,j)th element of the array A is denoted as A[i,j].
7. The following looping statements are used: while, for and repeat
until.
i) The general form of a while loop:
while( condition ) do
{
statement_1;
:
statement_n;
}
ii) The general form of a for loop:
for variable := value1 to value2 step step do
iii) The general form of a repeat-until loop:
repeat
<statement 1>
:
<statement n>
until ( condition )
The statements are executed as long as condition is false
8. A conditional statement has the following
forms:
• if < condition > then < statement >
• if < condition > then
< statement 1>
else
< statement 2>
9. Input and output are done using the instructions read and write.
Ex: read n;
write n;
12
10. Procedure or function starts with the word
Algorithm.
General form :
Algorithm Name( <parameter list> )
{
body
}
where Name is the name of the procedure.
Simple variables to procedures are passed by value.
Arrays and records are passed by reference
WRITE AN ALGORITHM TO FIND SUM OF N NUMBERS IN THE
GIVEN LIST
Algorithm sum(a,n)
{
s:=0;
for i:=1 to n do
s:=s+a[i];
return s;
}
14
WRITE AN ALGORITHM TO FIND FACTORIAL OF A GIVEN
NUMBER.
15
SAMPLE QUESTIONS
• Explain the Importance of Algorithm to Solve Real World Problems
• Summarize the Characteristics of Algorithm
• What is the difference between an algorithm and a program
• Describe the concept of recursion in algorithms. Provide an example algorithm that uses recursion
• What is an algorithm? Provide a brief definition and explain its importance in computer science.
• What is effectiveness in algorithms
• What is finiteness in algorithms
• In how many ways can we describe an algorithm
• What are the steps included in writing an algorithm
• How do we validate an algorithm
• How to Analyse an algorithm
16

More Related Content

PPT
UNIT-1-PPTS-DAA.ppt
PPT
UNIT-1-PPT-DESIGN AND ANALYSIS OF ALGORITHMS
PPT
UNIT-1-PPTS-DAA INTRO WITH DIVIDE AND CONQUER
PPT
UNIT 1- Design Analysis of algorithms and its working
PPT
UNIT-1-PPTS-DAA_INTRODUCTION_TO_DAA_GH.ppt
PPT
UNIT-1-PPTS-DAA.ppt
PPT
Introduction to Design Algorithm And Analysis.ppt
PDF
UNIT-1-PdjfjfjfjfjfjfjfjfjfjfjPTS-DAA.pdf
UNIT-1-PPTS-DAA.ppt
UNIT-1-PPT-DESIGN AND ANALYSIS OF ALGORITHMS
UNIT-1-PPTS-DAA INTRO WITH DIVIDE AND CONQUER
UNIT 1- Design Analysis of algorithms and its working
UNIT-1-PPTS-DAA_INTRODUCTION_TO_DAA_GH.ppt
UNIT-1-PPTS-DAA.ppt
Introduction to Design Algorithm And Analysis.ppt
UNIT-1-PdjfjfjfjfjfjfjfjfjfjfjPTS-DAA.pdf

Similar to session-1_Design_Analysis_Algorithm.pptx (20)

PDF
UNIT-1-PPTS-DAA_cofjfjvjcjcncnfncmpressed.pdf
PPTX
01 Introduction to analysis of Algorithms.pptx
PPTX
Design and Analysis of Algorithms.pptx
PPTX
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
PPTX
Introduction ,characteristics, properties,pseudo code conventions
PDF
ppts foe design and analysis of algorithm
PDF
DAA Notes.pdf
PPTX
Design and analysis of algorithms Module-I.pptx
PPTX
What is algorithm
PPT
UNIT-2-PPTS-DAA.ppt
PPTX
Chp-1 DAA (2).pptx design analysis and algoritham presentation
RTF
Design and Analysis of algorithms
PPTX
Unit-1_PPS_H6nS4p8J1iooinoinoinoink.pptx
PDF
lect 1-ds algo(final)_2.pdf
PDF
Algorithms notes 2 tutorials duniya
PPSX
Ds03 part i algorithms by jyoti lakhani
PPTX
daa18d8d-d333-4398-94dd-a46802d88d79.pptx
DOC
Program concep sequential statements
PPTX
Data structures algorithms basics
PPTX
problem solving and algorithm development
UNIT-1-PPTS-DAA_cofjfjvjcjcncnfncmpressed.pdf
01 Introduction to analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptx
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
Introduction ,characteristics, properties,pseudo code conventions
ppts foe design and analysis of algorithm
DAA Notes.pdf
Design and analysis of algorithms Module-I.pptx
What is algorithm
UNIT-2-PPTS-DAA.ppt
Chp-1 DAA (2).pptx design analysis and algoritham presentation
Design and Analysis of algorithms
Unit-1_PPS_H6nS4p8J1iooinoinoinoink.pptx
lect 1-ds algo(final)_2.pdf
Algorithms notes 2 tutorials duniya
Ds03 part i algorithms by jyoti lakhani
daa18d8d-d333-4398-94dd-a46802d88d79.pptx
Program concep sequential statements
Data structures algorithms basics
problem solving and algorithm development
Ad

More from chandankumar364348 (6)

PPTX
Multi-class Alzheimer’s Disease Classification Using Deep Learning Techniques
PPTX
Minimum Spanning Tree (Data Structure and Algorithm)
PPTX
Introduction and basic of Trees and Binary Trees
PPTX
Level of Program Correctness_Program_Reasoning.pptx
PPTX
Stack_Overview_Implementation_WithVode.pptx
PPT
Insert Sort & Merge Sort Using C Programming
Multi-class Alzheimer’s Disease Classification Using Deep Learning Techniques
Minimum Spanning Tree (Data Structure and Algorithm)
Introduction and basic of Trees and Binary Trees
Level of Program Correctness_Program_Reasoning.pptx
Stack_Overview_Implementation_WithVode.pptx
Insert Sort & Merge Sort Using C Programming
Ad

Recently uploaded (20)

PPT
Project quality management in manufacturing
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
PPT on Performance Review to get promotions
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PPT
Mechanical Engineering MATERIALS Selection
PPTX
additive manufacturing of ss316l using mig welding
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Well-logging-methods_new................
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPT
introduction to datamining and warehousing
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Construction Project Organization Group 2.pptx
Project quality management in manufacturing
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPT on Performance Review to get promotions
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
Internet of Things (IOT) - A guide to understanding
Mechanical Engineering MATERIALS Selection
additive manufacturing of ss316l using mig welding
Automation-in-Manufacturing-Chapter-Introduction.pdf
Well-logging-methods_new................
Fundamentals of safety and accident prevention -final (1).pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
introduction to datamining and warehousing
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
UNIT-1 - COAL BASED THERMAL POWER PLANTS
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Construction Project Organization Group 2.pptx

session-1_Design_Analysis_Algorithm.pptx

  • 1. Design and Analysis of Algorithm 1
  • 2. Muhammad ibn Musaal - Khwarizmi Father of Algorithm 2
  • 3. Definition: An algorithm is a finite set of instructions that accomplishes a particular task. All algorithms must satisfy the following criteria. Characteristics: 1. Input : Zero or more quantities are externally supplied. 2. Output : At least one quantity is produced. 3. Definiteness : Each instruction is clear and unambiguous. Statements such as “add 6 or 7 to x” is not permitted” 4. Finiteness : The algorithm should terminate after a finite number of steps. 5. Effectiveness : Instruction is basic enough to be carried out.
  • 4. Algorithms that are effective and definite are called computational procedures. Example : The operating system of a digital computer. To achieve the criterion of definiteness algorithm are written in a programming language. A program is the expression of an algorithm in a programming language.
  • 5. Areas for the study of algorithms: 1. How to devise an algorithm 2. How to validate an algorithm 3. How to analyze an algorithm 4. How to test a program ▪ Debugging ▪ Profiling
  • 6. 1. How to devise an algorithm To design new algorithm, we apply a existing design strategy. Some of the existing strategies are Divide and Conquer Greedy Method Dynamic Programming Back Tracking Branch and Bound etc. 2. How to validate an algorithm To check whether the algorithm giving correct output or not for all possible inputs.
  • 7. 3. How to analyze an algorithm Based on performance measures such as space and time i) How much time required ii) How much space required 4. How to test a program ▪ Debugging ▪ Profiling Debugging is a process of executing program on sample data sets, to determine whether any fault results occur. If so correct them. Profiling is a process of executing a correct program on sample data sets and determine how much time/space required by program
  • 8. Representation and Structure of an Algorithm: We can describe an algorithm in many ways. We can use a natural language like English, but if we select this option, we must make sure that the resulting instructions are definite. Graphic representations called flow charts are another possibility, but they work well only if the algorithm is small and simple. We can also represent algorithms using pseudo code that resemble C and Pascal.
  • 9. We present most of our algorithms using pseudo code that resembles C and Pascal. 1. Comments begin with // and continue until end of the line. 2. Blocks are indicated with matching braces: { and }. i. A compound statement ii. Body of a procedure. 3. i. An identifier begins with a letter. ii. The data types of variables are not explicitly declared. iii. The types will be clear from the context. iv. Whether a variable is global or local to a procedure will also be evident from the context. v. We assume simple data types such as integer, float, char, boolean, and so on. 9
  • 10. 4. Assignment of values to variables is done using the assignment statement. < variable > := < expression > 5. There are two boolean values true and false. To produce these values, logical operators and, or and not and the relational operators <, ≤,=, ≠, ≥ and > are provided. 6. Elements of multidimensional arrays are accessed using [ and ]. For example the (i,j)th element of the array A is denoted as A[i,j].
  • 11. 7. The following looping statements are used: while, for and repeat until. i) The general form of a while loop: while( condition ) do { statement_1; : statement_n; } ii) The general form of a for loop: for variable := value1 to value2 step step do
  • 12. iii) The general form of a repeat-until loop: repeat <statement 1> : <statement n> until ( condition ) The statements are executed as long as condition is false 8. A conditional statement has the following forms: • if < condition > then < statement > • if < condition > then < statement 1> else < statement 2> 9. Input and output are done using the instructions read and write. Ex: read n; write n; 12
  • 13. 10. Procedure or function starts with the word Algorithm. General form : Algorithm Name( <parameter list> ) { body } where Name is the name of the procedure. Simple variables to procedures are passed by value. Arrays and records are passed by reference
  • 14. WRITE AN ALGORITHM TO FIND SUM OF N NUMBERS IN THE GIVEN LIST Algorithm sum(a,n) { s:=0; for i:=1 to n do s:=s+a[i]; return s; } 14
  • 15. WRITE AN ALGORITHM TO FIND FACTORIAL OF A GIVEN NUMBER. 15
  • 16. SAMPLE QUESTIONS • Explain the Importance of Algorithm to Solve Real World Problems • Summarize the Characteristics of Algorithm • What is the difference between an algorithm and a program • Describe the concept of recursion in algorithms. Provide an example algorithm that uses recursion • What is an algorithm? Provide a brief definition and explain its importance in computer science. • What is effectiveness in algorithms • What is finiteness in algorithms • In how many ways can we describe an algorithm • What are the steps included in writing an algorithm • How do we validate an algorithm • How to Analyse an algorithm 16