SlideShare a Scribd company logo
Algorithms


      for
Program Design


                 1
Process Modelling
Process modelling is performed during the design
stage of developing a new system.
Data Flow Diagrams - show WHAT the new system
must be able to do.
Process Specification - provides details of HOW the
required functionality is achieved.
Various techniques used to clarify procedures
   Structure Diagrams
   Flow Charts
   Pseudocode / Structured English

Provides the logical design for a computer algorithm
                                                       2
Start
           Start
                                               Flow Charts
     Subtotal = 00
      Subtotal =                  •   Not to be confused with Data Flow Diagrams (DFDs)
     VAT = 1.175
     VAT = 1.175                      Shows steps required to achieve the
                                      correct outcome
    Input: ItemPrice
     Input: ItemPrice                 Flow charts provide a graphical
                                      representation of an algorithm
 Subtotal = Subtotal +
  Subtotal = Subtotal +                •   Can become complex and hard to follow
      ItemPrice
       ItemPrice                       •   Best used to give overview of functionality.
                                      Pseudocode provides a non-technical
                             no
    End of Item list?
     End of Item list?                description of an algorithm
                                       •   More detailed and closely related to
             yes                           programming code
Total = Subtotal **VAT
 Total = Subtotal VAT                 Structure diagrams are useful to show a
                                      hierarchical overview of program modules
        Output:
         Output:                       •   Helps to identify how the main project
“Total Price = £” (Total)
 “Total Price = £” (Total)                 components will be created
                                       •   Input - Processing - Output
          Stop
           Stop
                                                                                          3
Pseudocode
Pseudocode is a technique used during the design
stage of developing a program.
Used to translate the users requirements into a into a
complete sequence of unambiguous, logical steps.
It is written in Structured English to describe the
system operations accurately and precisely,
including all the steps need to code the program.
Can be understood by any programmer & coded into
any language.

                                                         4
How to….Create an Algorithm
 Start with a statement of the user’s needs
 Then write a program specification
 Then write out in sentences what the
 program needs to do at each step
 All of the time, consider how a computer runs
 an event driven program
   INPUT – PROCESS – OUTPUT



                                                 5
How to ... Pseudocode
Starting with general sentences (Structured English)
Remove as many of the extra words as you can - just
leave the bare minimum
If values are being entered - input:
   use the term “read in” or “get”…..
For any processing or calculations
   use the logical operators + - * / < > = “True”, “False”
If results are being displayed - output:
   use the term “print”
The final pseudocode should be language independent,
but must avoid any ambiguity.
                                                             6
Example:
  Description of the stages of a program for
  adding two numbers and displaying the result:

The user types in Number1
The user types in Number2
The program adds Number1 and Number2
The program displays the Total on the screen

  This isn’t written in pseudocode quite yet……


                                                  7
Example:

Read in Number1
Read in Number2
Total = Number1 + Number2
Print (Total)

 Now this is like program code
 Because of this it is called pseudocode
 Structured English is what it is written in


                                               8
Example: Verify Product




                          9
Example: Verify Product

For each Ordered Product
        Get Product(CatNo), Ordered(CatNo)
        If Product(CatNo) = Ordered (CatNo) Then
                Get Product (Level), Ordered (Quantity),
                If Product (Level) >= Ordered (Quantity) Then
                Order accepted = True
                Else
                Order accepted = False
                End If
        Else
                Print Invalid Product No
        End If
Next Product
Print confirmed order
                                                                10
Example: HND course




                      11
Example: Credit Card Authorisation
 START Bank connection
 GET Total due, Card type, Card number, Expiry date
 GET Stolen cards list
 IF Stolen = True THEN
            Print “Retain card and destroy”
 ELSE
            LOOP WHILE Counter < 3 AND PIN = False
                       Increment Counter
                       GET PIN
                       IF PIN = True THEN
                                  GET Limit, Balance
                                  IF Total Due < Limit - Balance THEN
                                             GET Ref (Transaction)
                                             Balance = Balance + Total Due
                                             PRINT “Transaction authorised” & Ref
                                  ELSE Authorised = False
                                             PRINT “Insufficient funds available”
                                  END IF
                                  EXIT Bank connection
                       END IF
            END LOOP
             PRINT “Incorrect PIN - Retain card and refer to bank”
 END IF
 EXIT Bank connection
                                                                                    12

More Related Content

What's hot (20)

PPT
Pseudocode algorithim flowchart
fika sweety
 
PPTX
Algorithm and flowchart
Elizabeth de Leon Aler
 
PPT
Introduction to Algorithms & flow charts
Yash Gupta
 
PPTX
Pseudocode
grahamwell
 
PPSX
Problem solving and design
Renée Howard-Johnson
 
PDF
Pseudocode By ZAK
Tabsheer Hasan
 
PPT
Csc 130 class 2 problem analysis and flow charts(2)
Puneet narula
 
PPTX
Introduction to flowchart
Jordan Delacruz
 
PPSX
Algorithm and flowchart
Sachin Goyani
 
PPTX
Flowchart and algorithem
ehsanullah786
 
PPT
3 algorithm-and-flowchart
Rohit Shrivastava
 
PPTX
Algorithms and flowcharts
Samuel Igbanogu
 
PPT
Algorithmsandflowcharts1
luhkahreth
 
PPT
2.3 Apply the different types of algorithm to solve problem
Frankie Jones
 
PPT
Flowchart
Gautam Roy
 
PPTX
pseudocode and Flowchart
ALI RAZA
 
PPT
Computer programming:Know How to Flowchart
Angelo Tomboc
 
PPTX
Chapter 6 algorithms and flow charts
Praveen M Jigajinni
 
PPTX
flowchart & algorithms
Student
 
PPTX
Flowchart and algorithm
DHANIK VIKRANT
 
Pseudocode algorithim flowchart
fika sweety
 
Algorithm and flowchart
Elizabeth de Leon Aler
 
Introduction to Algorithms & flow charts
Yash Gupta
 
Pseudocode
grahamwell
 
Problem solving and design
Renée Howard-Johnson
 
Pseudocode By ZAK
Tabsheer Hasan
 
Csc 130 class 2 problem analysis and flow charts(2)
Puneet narula
 
Introduction to flowchart
Jordan Delacruz
 
Algorithm and flowchart
Sachin Goyani
 
Flowchart and algorithem
ehsanullah786
 
3 algorithm-and-flowchart
Rohit Shrivastava
 
Algorithms and flowcharts
Samuel Igbanogu
 
Algorithmsandflowcharts1
luhkahreth
 
2.3 Apply the different types of algorithm to solve problem
Frankie Jones
 
Flowchart
Gautam Roy
 
pseudocode and Flowchart
ALI RAZA
 
Computer programming:Know How to Flowchart
Angelo Tomboc
 
Chapter 6 algorithms and flow charts
Praveen M Jigajinni
 
flowchart & algorithms
Student
 
Flowchart and algorithm
DHANIK VIKRANT
 

Viewers also liked (20)

PPT
Chap09
professorkarla
 
PPT
Erakartzeko marketing aurkezpena
ioritzrz
 
PPT
Chap15
professorkarla
 
PPT
Chap14
professorkarla
 
PPTX
Risk taking and emotions
Nitesh Singh
 
PPT
Chap04
professorkarla
 
PPT
Chap05
professorkarla
 
PPT
Chap06
professorkarla
 
PPT
Chap17
professorkarla
 
PPT
Asi Chap005
Putra Tidore
 
PPTX
Decisions
nicky_walters
 
PPTX
Simple debugging
nicky_walters
 
PPTX
Data types vbnet
nicky_walters
 
PPTX
Design for edp
nicky_walters
 
PPTX
Software development lifecycle
nicky_walters
 
PPT
Ch 3 event driven programming
Chaffey College
 
PPTX
Data structures vb
nicky_walters
 
PPTX
Ndu06 typesof language
nicky_walters
 
PPTX
Decisions
nicky_walters
 
PPTX
Design documentation
nicky_walters
 
Erakartzeko marketing aurkezpena
ioritzrz
 
Risk taking and emotions
Nitesh Singh
 
Asi Chap005
Putra Tidore
 
Decisions
nicky_walters
 
Simple debugging
nicky_walters
 
Data types vbnet
nicky_walters
 
Design for edp
nicky_walters
 
Software development lifecycle
nicky_walters
 
Ch 3 event driven programming
Chaffey College
 
Data structures vb
nicky_walters
 
Ndu06 typesof language
nicky_walters
 
Decisions
nicky_walters
 
Design documentation
nicky_walters
 
Ad

Similar to Algorithms (20)

DOC
Unit 2
rohassanie
 
PPT
Computer Programming - Lecture 2
Dr. Md. Shohel Sayeed
 
PPTX
Algorithm Design and Problem Solving [Autosaved].pptx
KaavyaGaur1
 
PPTX
vingautosaved-230525024624-6a6fb3b2.pptx
Orin18
 
PPT
The systems life cycle
odalyfer
 
PPT
Copy of dti2143/dam31303 chap 1 problem solving and program design
alish sha
 
DOC
Flow charts
Ankit Agarwal
 
PPTX
Algorithm itabq
mckennadglyn
 
PPT
Itc lec5-24+sep+2012
Rehan Qadri
 
PPSX
Visual basic ictl bi
nad_84
 
PPT
Unit 1 python (2021 r)
praveena p
 
PPT
Comp102 lec 1
Fraz Bakhsh
 
PPT
Introduction to problem solving in c++
Online
 
PPTX
Programming C ppt for learning foundations
ssuser65733f
 
PPTX
Introduction to problem solving Techniques
merlinjohnsy
 
PPTX
Basic syntax : Algorithm,Flow chart
Prasanna R Kovath
 
PPTX
Programming fundamentals lecture 3
Raja Hamid
 
PDF
Introducing MDSD
Pedro J. Molina
 
PPTX
Programming process and flowchart
hermiraguilar
 
PPTX
UNIT 1.pptx
ShaswatSurya
 
Unit 2
rohassanie
 
Computer Programming - Lecture 2
Dr. Md. Shohel Sayeed
 
Algorithm Design and Problem Solving [Autosaved].pptx
KaavyaGaur1
 
vingautosaved-230525024624-6a6fb3b2.pptx
Orin18
 
The systems life cycle
odalyfer
 
Copy of dti2143/dam31303 chap 1 problem solving and program design
alish sha
 
Flow charts
Ankit Agarwal
 
Algorithm itabq
mckennadglyn
 
Itc lec5-24+sep+2012
Rehan Qadri
 
Visual basic ictl bi
nad_84
 
Unit 1 python (2021 r)
praveena p
 
Comp102 lec 1
Fraz Bakhsh
 
Introduction to problem solving in c++
Online
 
Programming C ppt for learning foundations
ssuser65733f
 
Introduction to problem solving Techniques
merlinjohnsy
 
Basic syntax : Algorithm,Flow chart
Prasanna R Kovath
 
Programming fundamentals lecture 3
Raja Hamid
 
Introducing MDSD
Pedro J. Molina
 
Programming process and flowchart
hermiraguilar
 
UNIT 1.pptx
ShaswatSurya
 
Ad

More from nicky_walters (13)

PPTX
Pseudocode flowcharts
nicky_walters
 
PPTX
Data types vbnet
nicky_walters
 
PPTX
Data types vbnet
nicky_walters
 
PPTX
Ndu06 typesof language
nicky_walters
 
PPTX
Event driventheory
nicky_walters
 
PPTX
Simple debugging
nicky_walters
 
PPTX
Debugging
nicky_walters
 
PPTX
Using loops
nicky_walters
 
PPTX
Input output
nicky_walters
 
PPTX
Controls
nicky_walters
 
PPTX
Decisions
nicky_walters
 
PPTX
Intro to visual studio 2008
nicky_walters
 
PPTX
Input output
nicky_walters
 
Pseudocode flowcharts
nicky_walters
 
Data types vbnet
nicky_walters
 
Data types vbnet
nicky_walters
 
Ndu06 typesof language
nicky_walters
 
Event driventheory
nicky_walters
 
Simple debugging
nicky_walters
 
Debugging
nicky_walters
 
Using loops
nicky_walters
 
Input output
nicky_walters
 
Controls
nicky_walters
 
Decisions
nicky_walters
 
Intro to visual studio 2008
nicky_walters
 
Input output
nicky_walters
 

Algorithms

  • 1. Algorithms for Program Design 1
  • 2. Process Modelling Process modelling is performed during the design stage of developing a new system. Data Flow Diagrams - show WHAT the new system must be able to do. Process Specification - provides details of HOW the required functionality is achieved. Various techniques used to clarify procedures Structure Diagrams Flow Charts Pseudocode / Structured English Provides the logical design for a computer algorithm 2
  • 3. Start Start Flow Charts Subtotal = 00 Subtotal = • Not to be confused with Data Flow Diagrams (DFDs) VAT = 1.175 VAT = 1.175 Shows steps required to achieve the correct outcome Input: ItemPrice Input: ItemPrice Flow charts provide a graphical representation of an algorithm Subtotal = Subtotal + Subtotal = Subtotal + • Can become complex and hard to follow ItemPrice ItemPrice • Best used to give overview of functionality. Pseudocode provides a non-technical no End of Item list? End of Item list? description of an algorithm • More detailed and closely related to yes programming code Total = Subtotal **VAT Total = Subtotal VAT Structure diagrams are useful to show a hierarchical overview of program modules Output: Output: • Helps to identify how the main project “Total Price = £” (Total) “Total Price = £” (Total) components will be created • Input - Processing - Output Stop Stop 3
  • 4. Pseudocode Pseudocode is a technique used during the design stage of developing a program. Used to translate the users requirements into a into a complete sequence of unambiguous, logical steps. It is written in Structured English to describe the system operations accurately and precisely, including all the steps need to code the program. Can be understood by any programmer & coded into any language. 4
  • 5. How to….Create an Algorithm Start with a statement of the user’s needs Then write a program specification Then write out in sentences what the program needs to do at each step All of the time, consider how a computer runs an event driven program INPUT – PROCESS – OUTPUT 5
  • 6. How to ... Pseudocode Starting with general sentences (Structured English) Remove as many of the extra words as you can - just leave the bare minimum If values are being entered - input: use the term “read in” or “get”….. For any processing or calculations use the logical operators + - * / < > = “True”, “False” If results are being displayed - output: use the term “print” The final pseudocode should be language independent, but must avoid any ambiguity. 6
  • 7. Example: Description of the stages of a program for adding two numbers and displaying the result: The user types in Number1 The user types in Number2 The program adds Number1 and Number2 The program displays the Total on the screen This isn’t written in pseudocode quite yet…… 7
  • 8. Example: Read in Number1 Read in Number2 Total = Number1 + Number2 Print (Total) Now this is like program code Because of this it is called pseudocode Structured English is what it is written in 8
  • 10. Example: Verify Product For each Ordered Product Get Product(CatNo), Ordered(CatNo) If Product(CatNo) = Ordered (CatNo) Then Get Product (Level), Ordered (Quantity), If Product (Level) >= Ordered (Quantity) Then Order accepted = True Else Order accepted = False End If Else Print Invalid Product No End If Next Product Print confirmed order 10
  • 12. Example: Credit Card Authorisation START Bank connection GET Total due, Card type, Card number, Expiry date GET Stolen cards list IF Stolen = True THEN Print “Retain card and destroy” ELSE LOOP WHILE Counter < 3 AND PIN = False Increment Counter GET PIN IF PIN = True THEN GET Limit, Balance IF Total Due < Limit - Balance THEN GET Ref (Transaction) Balance = Balance + Total Due PRINT “Transaction authorised” & Ref ELSE Authorised = False PRINT “Insufficient funds available” END IF EXIT Bank connection END IF END LOOP PRINT “Incorrect PIN - Retain card and refer to bank” END IF EXIT Bank connection 12