0% found this document useful (0 votes)
9 views37 pages

Algorithms and PDLC Overview

The document outlines the Program Development Life Cycle (PDLC), which consists of phases including Analysis, Design, Development, Testing, and Documentation, emphasizing the importance of each phase in program development. It also discusses algorithm representations such as pseudocode and flowcharts, providing examples and explanations of their use in expressing algorithms. The document highlights the significance of clear documentation and testing to ensure program correctness and usability.

Uploaded by

muqhreezdanysh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views37 pages

Algorithms and PDLC Overview

The document outlines the Program Development Life Cycle (PDLC), which consists of phases including Analysis, Design, Development, Testing, and Documentation, emphasizing the importance of each phase in program development. It also discusses algorithm representations such as pseudocode and flowcharts, providing examples and explanations of their use in expressing algorithms. The document highlights the significance of clear documentation and testing to ensure program correctness and usability.

Uploaded by

muqhreezdanysh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Lecture 02

Problem Solving with


Algorithms
Prepared by Ban Kar Weng (William)
PDLC
Program Development Life Cycle
What is PDLC ?
1 Analysis • A set of phases that are
used to develop a
program.
2 Design
• Phase 1 - 4 are repeated
until any problems
3 Development encountered during the
development are solved.
4 Testing

5 Documentation
What is PDLC ?
1 Analysis All about the What.
• What the user wants from
the program?
2 Design • What is the input and
output of the program?
3 Development
Tasks Involved
• Gather user requirements
4 Testing

5 Documentation
What is PDLC ?
1 Analysis All about the How.
• How to fulfill what the user
wants?
2 Design • How the program is going
to achieve it?
3 Development
Tasks Involved
• Algorithm Design (using
4 Testing flowchart, pseudocode, or
other design tools.)
5 Documentation
What is PDLC ?
1 Analysis All about Code.
• Implement the algorithm
using programming
2 Design language(s)

Tasks Involved
3 Development
• Translate the algorithm
design into a programming
4 Testing language

5 Documentation
What is PDLC ?
1 Analysis All about Correctness.
• Test if the program does
what the user wants
2 Design correctly.

Tasks Involved
3 Development
• Check program’s output
and debug when needed.
4 Testing • Repeat Phase 1 if
enhancements are
required.
5 Documentation
What is PDLC ?
1 Analysis All about Recall.
• Ensure that programmers
able to recall what the
2 Design codes does in the future.

Tasks Involved
3 Development
• Generate written
documentations.
4 Testing • Improve source code
comments
5 Documentation
Algorithm
Representations
Algorithm Representations
How to represent or express algorithms?

Algorithm
Representation

Pseudocode Flowchart Program


Design Design Development
Pseudocode
Pseudocode
• Informal, high-level description of an algorithm.
• Not executable by computers.
• Allows precise description of algorithm without
worrying about the a programming language’s
syntax

Definition adopted from [Link] and C++ How to Program (8th Ed.) by Deitel and Deitel
Pseudocode: Examples
Example 1: Write a program that accepts an integer and outputs the
integer
Version 1:
INPUT an integer
OUTPUT the integer

Version 2:
INPUT X
OUTPUT X
Pseudocode: Examples
Example 2: Write a program calculating the sum of two integers
Version 1:
INPUT the first integer
INPUT the second integer
ADD the first integer and second integer, store result.
OUTPUT result

Version 2:
INPUT First
INPUT Second
Sum = First + Second
OUTPUT Sum
Flowchart
Flowchart
What do you understand
from the flowchart on
the right?

In what situation would I


“Watch TV” only once?

What happens if there is


truly no homework?
Flowchart
• A visual representation that shows the flow of the steps in
an algorithm.
• Consists of a flow of interconnected symbols.
• Not directly executable by computers.
• Easy to understand.
• Applied in computing and non-computing domain.
Flowchart
• How flowchart is designed depends on the intended
purpose.
 For human, the instructions in the symbols can be general.
 For machine, the instructions in each symbols must be convertible
to a programming language.

In the subsequent discussions, we assume that the flowchart


is intended for representing algorithms that will be
implemented in a machine.
Flowchart: Common Symbols (Part
1)
Diagram Name Description

Flow Connects symbols to show the algorithm flow.

Terminal Indicates the program’s start and end.


(i.e. )
start end
Input/Output Used to input data into the system or output data.

Process A process / action to be performed.


(e.g. a calculation or the assignment of a value)
Flowchart: The Input / Output
Symbol
• Input : Obtain data from an input device.
Variabl
e

Get N

• Output : Display data to an output device


Variabl
Value
e

Show “Hello” Show N

NOTE: “Get” or “Show” may be replaced with any word as long as it is unambiguous.
Flowchart: The Process Symbol
Indicates a particular operation.
In computing, this represents a CPU operation. The common ones
include: Variabl
e

• Assignment operation y <- 1 y <- x

• Arithmetic operation y <- x + 1 y <- y * x


Flowchart: Examples
Example 3: Start
Draw a flowchart that
accepts an integer and
outputs the integer To be demonstrated
live
Flowchart: Examples
Example 3: Start
Draw a flowchart that
accepts an integer and
outputs the integer
Flowchart: Examples Start

Example 4:
Draw a flowchart that
calculates the sum of two
To be demonstrated
integers
live
Flowchart: Examples Start

Example 4:
Draw a flowchart that
calculates the sum of two
integers.
Flowchart: Common Symbols (Part
2)
Diagram Name Description

Connector Connects separate flows in the same page.

Decision A yes/no question to be answered.


The program flow will then branch into one of
two paths, depending on the answer.
Flowchart: The Decision Symbol
Indicates a branching point. Lines coming out from the symbol
indicates different possible situations.
In computing, this symbol is often used evaluates Boolean expression,
so there are only two possible outcome: true or false (yes or no). Lines
coming out are connected by the Connector symbol.
Examples:
y=1

Output Output
“One” “Not One”
Start
Flowchart: Examples
Example 5:
Draw a flowchart that
accepts two integers and
To be demonstrated live
outputs the smallest.
Start
Flowchart: Examples
Example 5:
Draw a flowchart that
accepts two integers and
outputs the smallest.
Flowchart: Examples
Example 6:
Draw a flowchart that
accepts an integer.
Show “Zero” if the To be demonstrated live
integer is 0. Otherwise,
show “Positive” or
“Negative”, depending
on the sign of the
integer.
Flowchart: Examples
Example 6:
Draw a flowchart that
accepts an integer.
Show “Zero” if the
integer is 0. Otherwise,
show “Positive” or
“Negative”, depending
on the sign of the
integer.
Flowchart: Examples
Example 7:
Draw a flowchart that
shows “Hello”
infinitely. To be demonstrated live
Flowchart: Examples
Example 7:
Draw a flowchart that
shows “Hello”
infinitely.
Flowchart: Examples
Example 8:
Draw a flowchart that
shows “Hello” 100
times. To be demonstrated live
Flowchart: Examples
Example 8:
Draw a flowchart that
shows “Hello” 100
times.
Q&A
Acknowledgement
• This presentation has been designed using resources from
[Link]

Common questions

Powered by AI

Pseudocode and flowcharts both describe algorithms but differ in form and use. Pseudocode provides an informal, language-independent way of describing an algorithm's logic, emphasizing step-by-step instructions without specific syntax. Flowcharts use graphical symbols to represent different operations and control flows, offering a visual summary suitable for both human and initial machine-oriented designs .

The PDLC involves the phases of Analysis, Design, Development, Testing, and Documentation. These phases ensure the correctness of a program by gathering user requirements (Analysis), designing algorithms (Design), implementing these algorithms (Development), verifying the program's correctness through testing (Testing), and by creating documentation that allows future programmers to understand the code (Documentation).

Pseudocode facilitates the program design process because it provides an informal, high-level description of an algorithm. This allows designers to focus on the logic without worrying about programming language syntax, enabling precise description and communication of algorithms, which can be later translated into executable code .

Flowcharts for human understanding may use general instructions in symbols, while those intended for machines must have instructions convertible to programming languages. Common symbols include the Terminal (start/end), Input/Output, Process, and Decision, which depict operations like data input/output, computation, and flow direction .

Documentation is crucial because it ensures future programmers can understand and recall what the code does. It involves generating written documents and improving source code comments, which help maintain the program and make enhancements or debugging easier over time .

Terminal symbols indicate the start and end points of an algorithm in flowcharts. They are important because they clearly define when a process begins and ends, providing boundaries for the sequence of operations, which is essential for clear algorithm representation and implementation .

Decision symbols in flowcharts introduce branching in the algorithmic flow, which allows the execution to follow different paths based on a Boolean evaluation. They're typically used to handle conditions, such as evaluating expressions that result in True or False, guiding the program to execute different branches accordingly .

The 'Process' symbol in flowcharts contributes by representing operations that need to be performed, which can include assignment and arithmetic operations. This clarity allows one to follow the sequence of computational steps, making it easier to understand and implement algorithms .

In the PDLC, iterative testing ensures that a program meets user requirements by checking the accuracy and performance of the program's output. If enhancements are needed, the cycle revisits earlier phases like analysis to redefine requirements, and design to refine algorithms, thus enabling continuous improvement and adaptation to user needs .

The iterative nature of the PDLC is important because phases 1 to 4 are repeated to address and resolve problems encountered during development. This iterative cycle ensures continuous refinement and enhancement of the program, allowing developers to revisit analysis, design, development, and testing as needed to meet user requirements .

You might also like