SlideShare a Scribd company logo
3
Most read
4
Most read
5
Most read
Algorithm Development
• Algorithm is the sequence of steps to be
performed in order to solve a problem by the
computer.
Properties of Algorithm
• The given problem should be broken down
into simple and meaningful steps.
• The step should be numbered sequentially.
• The steps should be descriptive and written in
simple English.
Advantages of Algorithms
• Reduce Complexity by dividing the program
into simple and meaningful parts.
• Increase Flexibility Algorithm is written so that
the code may be written in any language.
• Ease of Understanding No need to understand
a particular programming language to
understand an algorithm.
How to write?
• Pseudocode is an artificial and informal
language that helps programmers to develop
algorithms.
– Pseudocode is very similar to everyday English.
• Two Steps to write an algorithm:-
– First produce a general algorithm (one can use pseudocode)
– Refine the algorithm successively to get step by step detailed
algorithm that is very close to a computer language.
• Example 1: Write an algorithm to determine a
student’s final grade and indicate whether it is
passing or failing. The final grade is calculated
as the average of four marks.
Example
Pseudocode:
• Input a set of 4 marks
• Calculate their average by summing and dividing by 4
• if average is below 50
Print “FAIL”
else
Print “PASS”
• Detailed Algorithm
• Step 1: Input M1,M2,M3,M4
Step 2: GRADE  (M1+M2+M3+M4)/4
Step 3: if (GRADE < 50) then
Print “FAIL”
else
Print “PASS”
endif
• Write an algorithm to convert the length in
feet to centimeter.
Pseudocode:
• Input the length in feet (Lft)
• Calculate the length in cm (Lcm) by
multiplying LFT with 30
• Print length in cm (LCM)
Algorithm
• Step 1: Input Lft
• Step 2: Lcm  Lft x 30
• Step 3: Print Lcm
• Write an algorithm that will calculate the roots of a
quadratic equation
• Hint: d = sqrt ( ), and the roots are:
x1 = (–b + d)/2a and x2 = (–b – d)/2a
2
4b ac
Pseudocode:
• Input the coefficients (a, b, c) of the quadratic
equation
• Calculate d
• Calculate x1
• Calculate x2
• Print x1 and x2
Algorithm:
• Step 1: Input a, b, c
• Step 2: d  sqrt ( )
• Step 3: x1  (–b + d) / (2 x a)
• Step 4: x2  (–b – d) / (2 x a)
• Step 5: Print x1, x2
4b b a c   
Write an algorithm that reads two values, determines the largest
value and prints the largest value with an identifying message.
ALGORITHM
Step 1: Input VALUE1, VALUE2
Step 2: if (VALUE1 > VALUE2) then
MAX  VALUE1
else
MAX  VALUE2
endif
Step 3: Print “The largest value is”, MAX
Write an algorithm that reads three numbers and prints the value of
the largest number.
Step 1: Input N1, N2, N3
Step 2: if (N1>N2) then
if (N1>N3) then
MAX  N1 [N1>N2, N1>N3]
else
MAX  N3 [N3>N1>N2]
endif
else
if (N2>N3) then
MAX  N2 [N2>N1, N2>N3]
else
MAX  N3 [N3>N2>N1]
endif
endif
Step 3: Print “The largest number is”, MAX
Example
Bonus Schedule
OVERTIME – (2/3)*ABSENT Bonus Paid
>40 hours
>30 but  40 hours
>20 but  30 hours
>10 but  20 hours
 10 hours
$50
$40
$30
$20
$10
• Step 1: Input NAME,OVERTIME,ABSENT
• Step 2: if (OVERTIME–(2/3)*ABSENT > 40) then
• PAYMENT  50
• else if (OVERTIME–(2/3)*ABSENT > 30) then
• PAYMENT  40
• else if (OVERTIME–(2/3)*ABSENT > 20) then
• PAYMENT  30
• else if (OVERTIME–(2/3)*ABSENT > 10) then
• PAYMENT 20
• else
• PAYMENT  10
• endif
• Step 3: Print “Bonus for”, NAME “is $”, PAYMENT

More Related Content

PDF
Strings in python
PDF
Symbol table in compiler Design
PPTX
Exception Handling in object oriented programming using C++
PDF
Python basic
PPT
Intermediate code generation (Compiler Design)
PPTX
Python-Inheritance.pptx
PPTX
LR(1) and SLR(1) parsing
PPT
constants, variables and datatypes in C
Strings in python
Symbol table in compiler Design
Exception Handling in object oriented programming using C++
Python basic
Intermediate code generation (Compiler Design)
Python-Inheritance.pptx
LR(1) and SLR(1) parsing
constants, variables and datatypes in C

What's hot (20)

PPTX
Dynamic memory allocation in c
PPTX
NLP_KASHK:Minimum Edit Distance
PPTX
Constant, variables, data types
PPTX
Fundamentals of c programming
PDF
Logistic regression in Machine Learning
PPTX
Timing and control
PPTX
While , For , Do-While Loop
PPT
Parsing
PPTX
Recursive Function
PPT
Function overloading(c++)
PPTX
Regular expressions in Python
PPTX
Directed Acyclic Graph Representation of basic blocks
PPTX
Intermediate code generator
PPTX
Constants, Variables, and Data Types
PPTX
Error Detection & Recovery
PPTX
Structure in C
PPTX
Instruction codes
PPTX
The role of the parser and Error recovery strategies ppt in compiler design
PPTX
Forward and Backward chaining in AI
Dynamic memory allocation in c
NLP_KASHK:Minimum Edit Distance
Constant, variables, data types
Fundamentals of c programming
Logistic regression in Machine Learning
Timing and control
While , For , Do-While Loop
Parsing
Recursive Function
Function overloading(c++)
Regular expressions in Python
Directed Acyclic Graph Representation of basic blocks
Intermediate code generator
Constants, Variables, and Data Types
Error Detection & Recovery
Structure in C
Instruction codes
The role of the parser and Error recovery strategies ppt in compiler design
Forward and Backward chaining in AI
Ad

Similar to Algorithm Development (20)

PPTX
Draw the flowchart of the above algorithm.pptx
PPT
3 algorithm-and-flowchart
PPTX
Programming fundamentals lecture 2 of c
PDF
Algorithm.pdf
PPTX
MODULE1-INTRODUCTION.pptx-COMPUTER PROGRAMING
PPTX
Pj01 1-computer and programming fundamentals
PPTX
Chp-1 DAA (2).pptx design analysis and algoritham presentation
PPT
programming language(C++) chapter-one contd.ppt
PPTX
Cs1123 2 comp_prog
PPTX
CSE115 C Programming Introduction North south university
PPTX
Algorithms-Flowcharts for programming fundamental
PPT
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
PPTX
PDF
algorithms and flow chart overview.pdf
PDF
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
PPTX
Lec 2 -algorithms-flowchart-and-pseudocode1.pptx
PPTX
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
PPT
UNIT-2-PPTS-DAA.ppt
PPTX
3 Program Development Life Cycle.aaaaapptx
PPTX
Unit 1 c programming language Tut and notes
Draw the flowchart of the above algorithm.pptx
3 algorithm-and-flowchart
Programming fundamentals lecture 2 of c
Algorithm.pdf
MODULE1-INTRODUCTION.pptx-COMPUTER PROGRAMING
Pj01 1-computer and programming fundamentals
Chp-1 DAA (2).pptx design analysis and algoritham presentation
programming language(C++) chapter-one contd.ppt
Cs1123 2 comp_prog
CSE115 C Programming Introduction North south university
Algorithms-Flowcharts for programming fundamental
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
algorithms and flow chart overview.pdf
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
Lec 2 -algorithms-flowchart-and-pseudocode1.pptx
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
UNIT-2-PPTS-DAA.ppt
3 Program Development Life Cycle.aaaaapptx
Unit 1 c programming language Tut and notes
Ad

More from ALI RAZA (20)

PPTX
Structure
PPTX
Recursion
PPTX
pseudocode and Flowchart
PPT
Programming Fundamentals using C++
PPTX
Introduction to Programming
PPTX
Introduction to Programming
PPTX
Array sorting
PPTX
Array programs
PPTX
2D-Array
DOCX
Quiz game documentary
PPTX
Function pass by value,function pass by reference
PPTX
Drug Addiction 39 Slides
PPTX
Drug Addiction Original 51 Slides
PPTX
Passing stuctures to function
PDF
Basic general knowledge
PDF
Dil hua kirchi kirchi by mohammad iqbal shams
PDF
Pathar kar-do-ankh-mein-ansu-complete
PDF
Husne akhlaq
PDF
Parts of speech sticky note definitions and examples
PDF
Quik tips
Structure
Recursion
pseudocode and Flowchart
Programming Fundamentals using C++
Introduction to Programming
Introduction to Programming
Array sorting
Array programs
2D-Array
Quiz game documentary
Function pass by value,function pass by reference
Drug Addiction 39 Slides
Drug Addiction Original 51 Slides
Passing stuctures to function
Basic general knowledge
Dil hua kirchi kirchi by mohammad iqbal shams
Pathar kar-do-ankh-mein-ansu-complete
Husne akhlaq
Parts of speech sticky note definitions and examples
Quik tips

Recently uploaded (20)

PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PPTX
Cell Structure & Organelles in detailed.
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Paper A Mock Exam 9_ Attempt review.pdf.
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
Cell Structure & Organelles in detailed.
2.FourierTransform-ShortQuestionswithAnswers.pdf
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
UNIT III MENTAL HEALTH NURSING ASSESSMENT
Final Presentation General Medicine 03-08-2024.pptx
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Practical Manual AGRO-233 Principles and Practices of Natural Farming
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
Anesthesia in Laparoscopic Surgery in India
A systematic review of self-coping strategies used by university students to ...
Weekly quiz Compilation Jan -July 25.pdf
Chinmaya Tiranga quiz Grand Finale.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx

Algorithm Development

  • 2. • Algorithm is the sequence of steps to be performed in order to solve a problem by the computer.
  • 3. Properties of Algorithm • The given problem should be broken down into simple and meaningful steps. • The step should be numbered sequentially. • The steps should be descriptive and written in simple English.
  • 4. Advantages of Algorithms • Reduce Complexity by dividing the program into simple and meaningful parts. • Increase Flexibility Algorithm is written so that the code may be written in any language. • Ease of Understanding No need to understand a particular programming language to understand an algorithm.
  • 5. How to write? • Pseudocode is an artificial and informal language that helps programmers to develop algorithms. – Pseudocode is very similar to everyday English. • Two Steps to write an algorithm:- – First produce a general algorithm (one can use pseudocode) – Refine the algorithm successively to get step by step detailed algorithm that is very close to a computer language.
  • 6. • Example 1: Write an algorithm to determine a student’s final grade and indicate whether it is passing or failing. The final grade is calculated as the average of four marks.
  • 7. Example Pseudocode: • Input a set of 4 marks • Calculate their average by summing and dividing by 4 • if average is below 50 Print “FAIL” else Print “PASS”
  • 8. • Detailed Algorithm • Step 1: Input M1,M2,M3,M4 Step 2: GRADE  (M1+M2+M3+M4)/4 Step 3: if (GRADE < 50) then Print “FAIL” else Print “PASS” endif
  • 9. • Write an algorithm to convert the length in feet to centimeter.
  • 10. Pseudocode: • Input the length in feet (Lft) • Calculate the length in cm (Lcm) by multiplying LFT with 30 • Print length in cm (LCM)
  • 11. Algorithm • Step 1: Input Lft • Step 2: Lcm  Lft x 30 • Step 3: Print Lcm
  • 12. • Write an algorithm that will calculate the roots of a quadratic equation • Hint: d = sqrt ( ), and the roots are: x1 = (–b + d)/2a and x2 = (–b – d)/2a 2 4b ac
  • 13. Pseudocode: • Input the coefficients (a, b, c) of the quadratic equation • Calculate d • Calculate x1 • Calculate x2 • Print x1 and x2
  • 14. Algorithm: • Step 1: Input a, b, c • Step 2: d  sqrt ( ) • Step 3: x1  (–b + d) / (2 x a) • Step 4: x2  (–b – d) / (2 x a) • Step 5: Print x1, x2 4b b a c   
  • 15. Write an algorithm that reads two values, determines the largest value and prints the largest value with an identifying message. ALGORITHM Step 1: Input VALUE1, VALUE2 Step 2: if (VALUE1 > VALUE2) then MAX  VALUE1 else MAX  VALUE2 endif Step 3: Print “The largest value is”, MAX
  • 16. Write an algorithm that reads three numbers and prints the value of the largest number. Step 1: Input N1, N2, N3 Step 2: if (N1>N2) then if (N1>N3) then MAX  N1 [N1>N2, N1>N3] else MAX  N3 [N3>N1>N2] endif else if (N2>N3) then MAX  N2 [N2>N1, N2>N3] else MAX  N3 [N3>N2>N1] endif endif Step 3: Print “The largest number is”, MAX
  • 17. Example Bonus Schedule OVERTIME – (2/3)*ABSENT Bonus Paid >40 hours >30 but  40 hours >20 but  30 hours >10 but  20 hours  10 hours $50 $40 $30 $20 $10
  • 18. • Step 1: Input NAME,OVERTIME,ABSENT • Step 2: if (OVERTIME–(2/3)*ABSENT > 40) then • PAYMENT  50 • else if (OVERTIME–(2/3)*ABSENT > 30) then • PAYMENT  40 • else if (OVERTIME–(2/3)*ABSENT > 20) then • PAYMENT  30 • else if (OVERTIME–(2/3)*ABSENT > 10) then • PAYMENT 20 • else • PAYMENT  10 • endif • Step 3: Print “Bonus for”, NAME “is $”, PAYMENT