SlideShare a Scribd company logo
Algorithm design and problem
solving
PROGRAM DEVELOPMENT LIFE
CYCLE(PDLC )
The program development life cycle is divided into five stages:
Analysis
Design
Coding
Testing
Maintenance
Analysis
• Before solving a problem, it is essential to define and document the
problem clearly, known as the "requirements specification" for the
program.
• The analysis stage involves using tools like abstraction and
decomposition to identify the specific requirements for the program.
• Abstraction focuses on the essential elements needed for the solution
while eliminating unnecessary details and information.
• Decomposition involves breaking down complex problems into smaller,
more manageable parts that can be solved individually.
• Daily tasks can be decomposed into constituent parts for easier
understanding and solving.
Design
The program specification derived from the analysis stage is used as a
guide for program development.
During the design stage, the programmer should clearly understand the
tasks to be completed, the methods for performing each task, and how
the tasks will work together.
Documentation methods such as structure charts, flowcharts, and
pseudocode can be used to document the program's design formally.
Coding and iterative testing
• The program or set of programs is developed based on the design.
• Each module of the program is written using a suitable programming
language.
• Testing is conducted to ensure that each module functions correctly.
• Iterative testing is performed, which involves conducting modular tests,
making code amendments if necessary, and repeating tests until the
module meets the required functionality.
Testing
• The completed program or set of programs is executed multiple times
using various test data sets.
• This testing process ensures that all the tasks within the program work
together as specified in the program design.
• Running the program with different test data can identify and address
potential issues and errors.
• The testing phase aims to verify the overall functionality and
performance of the program by evaluating its behaviour with various
inputs.
Decomposition
This is the act of breaking down a large problem into smaller, clear,
manageable and understandable sub-parts. Sub-parts can be divided until they
are easily solvable and cannot be broken down any further. An example of
decomposition could be getting ready in the morning to go to school
Step 1: Wake up
Step 2: Brush teeth
Step 3: Get breakfast
Step 4: Put clothes on
Step 5: Make sure the bag and school supplies are ready
Step 6: Find transport to school e.g. walk, bus, car, bike, etc
Example 1:
These steps could be further subdivided, for example, “Step 2: Get
breakfast” would entail:
Step 2.1 Get a bowl
Step 2.2 Get cereal
Step 2.3 Get milk
Step 2.4 Get a spoon
Step 2.5 Put cereal in a bowl
And so on…
Methods used to
design and construct
a solution to a
problem
❑ Structure diagrams
❑ Flowcharts
❑ Pseudocode
Example 2: Structure diagrams
Consider the alarm application for a smart phones. It contain
three sub-systems – setting the alarm, checking alarm time,
sounding alarm
Flowcharts
A flowchart show graphical /
diagrammatically the steps required to
complete a task the order that they are to
be performed. The steps together with the
order, are called an algorithm.
FLOWCHARTS SYMBOL
Example 3: Concert
ticket Sales
Tickets are sold for a concert at $20 each, if
10 tickets are bought then the discount is
10%, if 20 tickets are bought is 20 %. No
more than 25 tickets can be bought in a single
transaction. This is flowchart an algorithm to
calculate the cost of buying a given number of
tickets.
PSEUDOCODE
Pseudocode is a simple method of showing an algorithm. It describe what
the algorithm does by using English keywords that are very similar to
those used in a high-level programming language.
Example of pseudocode assignment statements:
Cost  10 Cost has the value 10
Price  Cost * 2 Price has the value 20
Tax Price * 0.12 Tax has the value 2.4
Selling Price  Price + Tax Selling Price has the value 22.4
Gender  “M” Gender has value M
Choose False Chosen the value False
Pseudocode for Conditional
Statements
Two Types of conditional Statement:
1. Condition that can be true or false as: IF ..THEN …ELSE…END IF
IF AGE > 18
THEN
OUTPUT “ELIGIBLE FOR VOTING
ELSE
OUTPUT “NOT ELIGIBLE FOR VOTING
ENDIF
CONT..
2. A choice between several different values, such as: CASE
OF…OTHERWISE….ENDCASE
CASE OF Grade
“A” : OUTPUT “Excellent”
“B”: OUTPUT “Good”
“C”: OUTPUT “Average”
OTHERWISE, OUTPUT “Improvement is needed
ENDCASE
IF..THEN..ELSE..ENDIF
For an IF condition the THEN path is followed if the condition is true and
the ELSE path is followed if the condition is false. There may or may not
be an ELSE path. The end of the statement is shown by ENDIF.
There are different ways that an IF condition can be set up:
IF (Height >1) OR (Weight > 20) AND (Age < 70) AND (Age > 5)
THEN
OUTPUT “You can ride”
ELSE
OUTPUT “Too small, to young or old to ride”
ENDIF
Example: CASE
OF…OTHERWISE…ENDCASE
CASE OF Choice
1: Answer  Num1 + Num2
2: Answer  Num1 – Num2
3: Answer  Num1 * Num2
4. Answer  Num1 / Num2
OTHERWISE, OUTPUT “Please enter a valid choice”
ENDCASE
Pseudocode for iteration
Some action performed as part of an algorithm need repeating this
is called iteration. Loop structure are used to perform the iteration.
• FOR …TO…NEXT ---> A set number of repetitions
• REPEAT …UNTIL ---> A repetition, where the number of repeats
is not known, that is completed at least once.
• WHILE..DO..ENDWHILE ---> A repetition, where the number of
repeats is not known, that may never be completed.
All types of loops
A FOR …NEXT loop
A WHILE
…DO…ENDWHILE loop
A REPEAT….UNTIL loop
THANK YOU
Q&A

More Related Content

PPT
Class 7 lecture notes
PPT
PPT
Software testing - EXAMPLE
PPTX
Software develop....
PPTX
Evaluation
PPTX
H evaluation
PPTX
vingautosaved-230525024624-6a6fb3b2.pptx
PPTX
Algorithm Design and Problem Solving [Autosaved].pptx
Class 7 lecture notes
Software testing - EXAMPLE
Software develop....
Evaluation
H evaluation
vingautosaved-230525024624-6a6fb3b2.pptx
Algorithm Design and Problem Solving [Autosaved].pptx

Similar to Algorithm Design and Problem Solving.pdf (20)

PPTX
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
PPTX
classVI_Coding_Teacher_Presentation.pptx
PPTX
classVI_Coding_Teacher_Presentation.pptx
PPT
Testing Software Solutions
PPTX
UNIT 1.pptx
PPT
PPTX
Programming Fundamentals
PDF
Methodology Patterns (Agile Cambridge 2014)
PPT
Ch1 principles of software development
PPTX
Fundamentals of Problem Solving using Python.pptx
PPTX
Building Test Cases and Plans.pptx in computer science
PDF
The answer is b
PPS
Testing techniques
PPTX
Chapter 6 algorithms and flow charts
PPT
Chapter 2- Prog101.ppt
PPTX
Algorithms and Programming
PPTX
Analysis
PPTX
PPTX
11 Unit 1 Problem Solving Techniques
PPTX
Test Coverage: An Art and a Science
INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE
classVI_Coding_Teacher_Presentation.pptx
classVI_Coding_Teacher_Presentation.pptx
Testing Software Solutions
UNIT 1.pptx
Programming Fundamentals
Methodology Patterns (Agile Cambridge 2014)
Ch1 principles of software development
Fundamentals of Problem Solving using Python.pptx
Building Test Cases and Plans.pptx in computer science
The answer is b
Testing techniques
Chapter 6 algorithms and flow charts
Chapter 2- Prog101.ppt
Algorithms and Programming
Analysis
11 Unit 1 Problem Solving Techniques
Test Coverage: An Art and a Science
Ad

Recently uploaded (20)

PPTX
sap open course for s4hana steps from ECC to s4
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Machine Learning_overview_presentation.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Machine learning based COVID-19 study performance prediction
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
A Presentation on Artificial Intelligence
PPTX
Programs and apps: productivity, graphics, security and other tools
sap open course for s4hana steps from ECC to s4
Advanced methodologies resolving dimensionality complications for autism neur...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Machine Learning_overview_presentation.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Chapter 3 Spatial Domain Image Processing.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Mobile App Security Testing_ A Comprehensive Guide.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
MIND Revenue Release Quarter 2 2025 Press Release
Per capita expenditure prediction using model stacking based on satellite ima...
Machine learning based COVID-19 study performance prediction
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
A comparative analysis of optical character recognition models for extracting...
Encapsulation_ Review paper, used for researhc scholars
A Presentation on Artificial Intelligence
Programs and apps: productivity, graphics, security and other tools
Ad

Algorithm Design and Problem Solving.pdf

  • 1. Algorithm design and problem solving
  • 2. PROGRAM DEVELOPMENT LIFE CYCLE(PDLC ) The program development life cycle is divided into five stages: Analysis Design Coding Testing Maintenance
  • 3. Analysis • Before solving a problem, it is essential to define and document the problem clearly, known as the "requirements specification" for the program. • The analysis stage involves using tools like abstraction and decomposition to identify the specific requirements for the program. • Abstraction focuses on the essential elements needed for the solution while eliminating unnecessary details and information. • Decomposition involves breaking down complex problems into smaller, more manageable parts that can be solved individually. • Daily tasks can be decomposed into constituent parts for easier understanding and solving.
  • 4. Design The program specification derived from the analysis stage is used as a guide for program development. During the design stage, the programmer should clearly understand the tasks to be completed, the methods for performing each task, and how the tasks will work together. Documentation methods such as structure charts, flowcharts, and pseudocode can be used to document the program's design formally.
  • 5. Coding and iterative testing • The program or set of programs is developed based on the design. • Each module of the program is written using a suitable programming language. • Testing is conducted to ensure that each module functions correctly. • Iterative testing is performed, which involves conducting modular tests, making code amendments if necessary, and repeating tests until the module meets the required functionality.
  • 6. Testing • The completed program or set of programs is executed multiple times using various test data sets. • This testing process ensures that all the tasks within the program work together as specified in the program design. • Running the program with different test data can identify and address potential issues and errors. • The testing phase aims to verify the overall functionality and performance of the program by evaluating its behaviour with various inputs.
  • 7. Decomposition This is the act of breaking down a large problem into smaller, clear, manageable and understandable sub-parts. Sub-parts can be divided until they are easily solvable and cannot be broken down any further. An example of decomposition could be getting ready in the morning to go to school Step 1: Wake up Step 2: Brush teeth Step 3: Get breakfast Step 4: Put clothes on Step 5: Make sure the bag and school supplies are ready Step 6: Find transport to school e.g. walk, bus, car, bike, etc
  • 8. Example 1: These steps could be further subdivided, for example, “Step 2: Get breakfast” would entail: Step 2.1 Get a bowl Step 2.2 Get cereal Step 2.3 Get milk Step 2.4 Get a spoon Step 2.5 Put cereal in a bowl And so on…
  • 9. Methods used to design and construct a solution to a problem ❑ Structure diagrams ❑ Flowcharts ❑ Pseudocode
  • 10. Example 2: Structure diagrams Consider the alarm application for a smart phones. It contain three sub-systems – setting the alarm, checking alarm time, sounding alarm
  • 11. Flowcharts A flowchart show graphical / diagrammatically the steps required to complete a task the order that they are to be performed. The steps together with the order, are called an algorithm.
  • 13. Example 3: Concert ticket Sales Tickets are sold for a concert at $20 each, if 10 tickets are bought then the discount is 10%, if 20 tickets are bought is 20 %. No more than 25 tickets can be bought in a single transaction. This is flowchart an algorithm to calculate the cost of buying a given number of tickets.
  • 14. PSEUDOCODE Pseudocode is a simple method of showing an algorithm. It describe what the algorithm does by using English keywords that are very similar to those used in a high-level programming language. Example of pseudocode assignment statements: Cost  10 Cost has the value 10 Price  Cost * 2 Price has the value 20 Tax Price * 0.12 Tax has the value 2.4 Selling Price  Price + Tax Selling Price has the value 22.4 Gender  “M” Gender has value M Choose False Chosen the value False
  • 15. Pseudocode for Conditional Statements Two Types of conditional Statement: 1. Condition that can be true or false as: IF ..THEN …ELSE…END IF IF AGE > 18 THEN OUTPUT “ELIGIBLE FOR VOTING ELSE OUTPUT “NOT ELIGIBLE FOR VOTING ENDIF
  • 16. CONT.. 2. A choice between several different values, such as: CASE OF…OTHERWISE….ENDCASE CASE OF Grade “A” : OUTPUT “Excellent” “B”: OUTPUT “Good” “C”: OUTPUT “Average” OTHERWISE, OUTPUT “Improvement is needed ENDCASE
  • 17. IF..THEN..ELSE..ENDIF For an IF condition the THEN path is followed if the condition is true and the ELSE path is followed if the condition is false. There may or may not be an ELSE path. The end of the statement is shown by ENDIF. There are different ways that an IF condition can be set up: IF (Height >1) OR (Weight > 20) AND (Age < 70) AND (Age > 5) THEN OUTPUT “You can ride” ELSE OUTPUT “Too small, to young or old to ride” ENDIF
  • 18. Example: CASE OF…OTHERWISE…ENDCASE CASE OF Choice 1: Answer  Num1 + Num2 2: Answer  Num1 – Num2 3: Answer  Num1 * Num2 4. Answer  Num1 / Num2 OTHERWISE, OUTPUT “Please enter a valid choice” ENDCASE
  • 19. Pseudocode for iteration Some action performed as part of an algorithm need repeating this is called iteration. Loop structure are used to perform the iteration. • FOR …TO…NEXT ---> A set number of repetitions • REPEAT …UNTIL ---> A repetition, where the number of repeats is not known, that is completed at least once. • WHILE..DO..ENDWHILE ---> A repetition, where the number of repeats is not known, that may never be completed.
  • 20. All types of loops A FOR …NEXT loop A WHILE …DO…ENDWHILE loop A REPEAT….UNTIL loop