0% found this document useful (0 votes)
32 views

Data Structure and Algorithm - Fundamental Programing Part 2

The document describes flowcharts, which are graphical representations of algorithms used to define and analyze processes. It discusses the basic components of a flowchart including start/end symbols, arrows, processing steps, inputs/outputs, conditionals, and displays. Rules for constructing flowcharts are provided regarding page layout, symbol limits, and flow direction. Advantages of flowcharts like effective communication, analysis, documentation, coding, debugging and maintenance are covered. Basic control structures of sequence, selection, and loops are explained. Two examples of flowcharts for calculating an average and finding the largest of three numbers are shown.

Uploaded by

eli indah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Data Structure and Algorithm - Fundamental Programing Part 2

The document describes flowcharts, which are graphical representations of algorithms used to define and analyze processes. It discusses the basic components of a flowchart including start/end symbols, arrows, processing steps, inputs/outputs, conditionals, and displays. Rules for constructing flowcharts are provided regarding page layout, symbol limits, and flow direction. Advantages of flowcharts like effective communication, analysis, documentation, coding, debugging and maintenance are covered. Basic control structures of sequence, selection, and loops are explained. Two examples of flowcharts for calculating an average and finding the largest of three numbers are shown.

Uploaded by

eli indah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Flowchart

23jul22

⚫ A flowchart is a graphical representation of an


algorithm.
⚫ These flowcharts play a vital role in the
programming of a problem and are quite helpful in
understanding the logic of complicated and lengthy
problems.
⚫ Once the flowchart is drawn, it becomes easy to
write the program in any high level language.
Flowchart
Flowchart
⚫ A flowchart can therefore be used to:
 Define and analyze processes

 Build a step-by-step picture of the process for analysis,


discussion, or communication
 Define, standardize or find areas for improvement in a
process
Flowchart

Flowchart
Flowchart
Flowchart Symbols
Start and End symbols

⚫ Represented as lozenges, ovals or rounded rectangles


⚫ Usually containing the word "Start" or "End", or another
phrase signalling the start or end of a process, such as
"submit enquiry" or "receive product".
Flowchart
Flowchart Symbols
Arrows

⚫ Showing what's called "flow of control" in computer


science.
⚫ An arrow coming from one symbol and ending at
another symbol.
⚫ Represents that control passes to the symbol the arrow
points to.
Flowchart
Flowchart Symbols
Processing steps

⚫ Represented as rectangles.
⚫ Examples: “Add 1 to X"; "replace identified part";
"save changes" or similar.
Flowchart
Flowchart Symbols
Input/Output

⚫ Represented as a parallelogram.
⚫ Examples: Get X from the user; display X.
Flowchart
Flowchart Symbols
Conditional or decision

⚫ Represented as a diamond (rhombus).


⚫ These typically contain a Yes/No question or
True/False test.
Algorithms

Flowchart Symbols
Display

⚫ Indicates a process flow step where information is


displayed to a person (e.g., PC user, machine
operator).
Flowchart
Rules for Flowchart
1. Every flow chart has a START symbol and a STOP
symbol.
2. The flow of sequence is generally from the top of
the page to the bottom of the page. This can vary
with loops which need to flow back to an entry
point.
3. Use arrow-heads on connectors where flow
direction may not be obvious.
4. There is only one flow chart per page.
Flowchart
Rules for Flowchart
5. A page should have a page number and a title.
6. A flow chart on one page should not break and
jump to another page
7. A flow chart should have no more than around 15
symbols (not including START and STOP).
Flowchart
Advantages of Using Flowcharts
⚫ Communication: Flowcharts are better way of communicating
the logic of a system to all concerned.
⚫ Effective analysis: With the help of flowchart, problem can be
analysed in more effective way.
⚫ Proper documentation: Program flowcharts serve as a good
program documentation, which is needed for various purposes.
⚫ Efficient Coding: The flowcharts act as a guide or blueprint
during the systems analysis and program development phase.
Flowchart
Advantages of Using Flowcharts
⚫ Proper Debugging: The flowchart helps in debugging
process.
⚫ Efficient Program Maintenance: The maintenance of
operating program becomes easy with the help of flowchart. It
helps the programmer to put efforts more efficiently on that
part.
Flowchart
Basic Control Structures
⚫ Sequence
⚫ Selection
⚫ Loop
Flowchart
Basic Control Structures
Sequence

⚫ Steps that execute in sequence are represented by symbols that follow


each other top to bottom or left to right.
⚫ Top to bottom is the standard.
Flowchart
Basic Control Structures
Sequence
Flowchart
Basic Control Structures
Selection/Branching

⚫ Once the condition is evaluated, the control flows into one of two
paths.
⚫ Once the conditional execution is finished, the flows rejoin before
leaving the structure.
Flowchart
Basic Control Structures
Selection/Branching
Flowchart
Basic Control Structures
Loop

⚫ Either the processing repeats or the control leaves


the structure.
⚫ Notice that the return line joins the entry line
before the question.
Flowchart
Basic Control Structures
Loop
Flowchart
Example 1:
Algorithm:

Input: two numbers x and y


Output: the average of x and y
Steps:
1. input x
2. input y
3. sum = x + y
4. average = sum /2
5. output average
Flowchart

Example 1:
Flowchart
Example 2:

Draw a flowchart to find the largest of three numbers


A, B, and C.
Flowchart

Example 2:
Flowchart
Exercise:
Draw a flowchart diagram.
1.A program that compare the first number and
second number and display which one is the biggest.

2.Login screen to check the Username and


Password.
Flowchart
Exercise:
Draw a flowchart diagram.
1.A program that compare the first number and
second number and display which one is the biggest.

2.Login screen to check the Username and


Password.
End of Part 2

You might also like