SlideShare a Scribd company logo
Flow Chart and Pseudo Code
© Dr. Jyoti Lakhani
The American National Standards Institute (ANSI) set standards for
flowcharts and their symbols in the 1960s.
The International Organization for Standardization (ISO) adopted the
ANSI symbols in 1970.
The current standard, ISO 5807, was revised in 1985.
Generally, flowcharts flow from top to bottom and left to right.
© Dr. Jyoti Lakhani
What is a Flowchart?
A flowchart is a graphical representations of steps of an Algorithm and
programming logic
Flowchart Symbols
Terminator
Process
The terminator symbol represents the starting or
ending point of the system.
A box indicates some particular operation.
© Dr. Jyoti Lakhani
This represents a printout, such as a
document or a report.
Document
Decision A diamond represents a decision or branching
point. Lines coming out from the diamond
indicates different possible situations, leading
to different sub-processes.
Data
It represents information entering or leaving
the system. An input might be an order from a
customer. Output can be a product to be
delivered.
Lines represent the flow of the sequence and
direction of a process.
Flow
© Dr. Jyoti Lakhani
On-Page Reference This symbol would contain a letter inside. It
indicates that the flow continues on a
matching symbol containing the same letter
somewhere else on the same page.
This symbol would contain a letter inside. It
indicates that the flow continues on a
matching symbol containing the same letter
somewhere else on a different page.
Off-Page Reference
Identifies a delay or a bottleneck.
Delay or Bottleneck
© Dr. Jyoti Lakhani
Annotation
Indicating additional information about a step
in the program. Represented as an open
rectangle with a dashed or solid line
connecting it to the corresponding symbol in
the flowchart
Shows named process which is defined
elsewhere. Represented as a rectangle
with double-struck vertical edges
Predefined Process
Data File or
Database
Single documents
Multiple documents
© Dr. Jyoti Lakhani
Manual operation
Manual input
Preparation or Initialization
© Dr. Jyoti Lakhani
© Dr. Jyoti Lakhani
Calculate Profit and Loss
© Dr. Jyoti Lakhani
Draw a flowchart to input two numbers from
user and display the largest of two numbers
© Dr. Jyoti Lakhani
http://flowgorithm.org/download/index.htm
Download, Install and Practice
© Dr. Jyoti Lakhani
© Dr. Jyoti Lakhani
An example of Algorithm
Algorithm to add two numeric values
1. Declare two variables n1 and n2
2. Read values in n1 and n2
3. Declare one more variable sum
4. Add n1 and n2 and assign result in sum
5. Print sum
General English
Flow Chart Implementation
Algorithm to add two numeric values
Start
End
Input n1
Input n2
Print Sum
Sum = n1 + n2
© Dr. Jyoti Lakhani
Algorithm Name: Add_Numbers ( n1, n2)
Input: Two integers n1 and n2
Output: sum of n1 and n2
Start
1. sum <- n1 + n2
2. Print sum
End
Pseudo Code Implementation
Algorithm to add two numeric values
© Dr. Jyoti Lakhani
Pseudo code is a simple way of writing programming code in English
Pseudo code is simply an implementation of an algorithm in the form of
annotations and informative text written in plain English.
Pseudo code is not actual programming language
It has no syntax like any of the programming language and thus can’t
be compiled or interpreted by the computer.
Algorithms will often be expressed in pseudo code
WHY?
WHAT? A mixture of code and English
“While understanding pseudo code is usually not difficult, writing it can be
a challenge” © Dr. Jyoti Lakhani
Why use pseudo code at all?
If we write an algorithm in English,
the description may be at so high a level that it is
difficult to analyze the algorithm and to transform
it into code.
If instead we write the algorithm in code,
we have invested a lot of time in determining the
details of an algorithm we may not choose to
implement?
The GOAL of writing pseudo code, then, is
to provide a high-level description of an algorithm which
facilitates analysis and eventual coding
but at the same time suppresses many of the details that
vanish with asymptotic notation
© Dr. Jyoti Lakhani
Why use pseudo code at all?
It allows the designer to focus on the logic of the
algorithm without being distracted by details of language
syntax.
It describe the entire logic of the algorithm so that
implementation becomes a rote mechanical task of
translating line by line into source code.
© Dr. Jyoti Lakhani
Here are a few general guidelines for checking your pseudo code:
-Naomi Nishimura
1. Mimic good code and good English:
It is still important that variable names be mnemonic, comments be included
where useful, and English phrases be comprehensible (full sentences are usually
not necessary).
2. Ignore unnecessary details:
you shouldn’t obsess about syntax at all
3. Arrange the sequence of tasks and write the pseudo code accordingly
4. Aim of the algorithm:
Start with the statement of a pseudo code which establishes the main goal or the
aim.
Example:
This program will allow the user to check the number whether it's
even or odd. © Dr. Jyoti Lakhani
5. Proper Indentation:
The way the if-else, for, while loops are indented in a program, indent the
statements likewise, as it helps to comprehend the decision control and
execution mechanism. They also improve the readability to a great extent.
Example:
if "1"
print response "I am case 1"
if "2"
print response "I am case 2".
Example:
if "1“ print response "I am case 1“ if "2“ print response
"I am case 2"
© Dr. Jyoti Lakhani
5. Don’t be labor the obvious:
In many cases, the type of a variable is clear from context; it is often
unnecessary to make it explicit.
6. Take advantage of programming short-hands:
Using if-then-else or looping structures is more concise than writing out
the equivalent in English;
Using parameters in specifying procedures is concise, clear, and
accurate, and hence should not be omitted from pseudo code.
7. Use appropriate naming conventions
The human tendency follows the approach to follow what we see. If a
programmer goes through a pseudo code, his approach will be the
same as per it, so the naming must be simple and distinct.
© Dr. Jyoti Lakhani
8. Use appropriate Naming Convention:
such as Camel Case for methods, upper case for constants and lower case for
variables.
9. Elaborate everything which is going to happen in the actual code:
Don’t make the pseudo code abstract
10. Use standard programming structures
such as ‘if-then’, ‘for’, ‘while’, ‘cases’ the way we use it in programming
11. Check whether all the sections of a pseudo code is complete, finite and clear to
understand and comprehend
12. Don’t write the pseudo code in a complete programmatic manner:
It is necessary to be simple to understand even for a layman or client, hence
don’t incorporate too many technical terms.
© Dr. Jyoti Lakhani
Advantages of Pseudo code
1. Improves the readability of any approach. It’s one of the best
approaches to start implementation of an algorithm
2. Acts as a bridge between the program and the algorithm or
flowchart
3. Also works as a rough documentation, so the program of one
developer can be understood easily when a pseudo code is written
out. In industries, the approach of documentation is essential. And
that’s where a pseudo-code proves vital
4. The main goal of a pseudo code is to explain what exactly each line
of a program should do, hence making the code construction
phase easier for the programmer
© Dr. Jyoti Lakhani
No broad standard for pseudo code syntax exists, as a program in pseudocode is not
an executable program, however certain limited standards exist
Pseudo code resembles skeleton programs which can be compiled without errors.
Flowcharts,
drakon-charts and
Unified Modelling Language (UML) charts can be thought of as a graphical
alternative to pseudo code, but are more spacious on paper.
Languages such as HAGGIS bridge the gap between pseudo code and code written in
programming languages.
- Wiki
© Dr. Jyoti Lakhani
Type of
operation
Symbol Example
Assignment ← or := c ← 2πr, c := 2πr
Comparison =, ≠, <, >, ≤, ≥
Arithmetic +, −, ×, /, mod
Floor/ceiling ⌊, ⌋, ⌈, ⌉ a ← ⌊b⌋ + ⌈c⌉
Logical and, or
Sums, products Σ Π h ← Σa∈A 1/a
Some Conventions to write Pseudo Code
- Wiki
© Dr. Jyoti Lakhani
Common Action Keywords:
Input: READ
OBTAIN
GET
Output:
PRINT
DISPLAY
SHOW
Compute:
COMPUTE
CALCULATE
DETERMINE
Initialize:
SET
INIT
Add one:
INCREMENT
BUMP
Action Words
© Dr. Jyoti Lakhani
IF-THEN-ELSE
The general form is:
IF condition THEN
sequence 1
ELSE
sequence 2
ENDIF
IF HoursWorked > NormalMax THEN
Display overtime message
ELSE
Display regular time message
ENDIF
Example:
© Dr. Jyoti Lakhani
WHILE
The general form is:
WHILE condition
sequence
ENDWHILE
The loop is entered only if the condition is true.
WHILE Population < LimitCompute
Population as Population + Births – Deaths
ENDWHILE
© Dr. Jyoti Lakhani
CASE
The general form is:
CASE expression OF
condition 1 :
sequence 1
condition 2 :
sequence 2
...
condition n :
sequence n
OTHERS:
default sequence
ENDCASE
CASE grade OF
A :
points = 4
B :
points = 3
C :
points = 2
D :
points = 1
OTHERS :
points = 5
ENDCASE
© Dr. Jyoti Lakhani
FOR
The general form is:
FOR iteration bounds
sequence
ENDFOR
Example:
FOR each month of the year (good)
FOR month = 1 to 12 (ok)
FOR each employee in the list (good)
FOR empno = 1 to listsize (ok)
© Dr. Jyoti Lakhani
REPEAT-UNTIL
The general form is:
REPEAT
sequence
UNTIL condition
NESTED CONSTRUCTS
Example:
SET total to zero
REPEAT
READ Temperature
IF Temperature > Freezing THEN
INCREMENT total
END IF
UNTIL Temperature < zero
© Dr. Jyoti Lakhani
INVOKING SUBPROCEDURES
Use the CALL keyword.
For example:
CALL AvgAge with StudentAges
CALL Swap (CurrentItem, TargetItem)
CALL getBalance RETURNING aBalance
BEGIN
statements
EXCEPTION
WHEN exception type
statements to handle exception
WHEN another exception type
statements to handle exception
END
EXCEPTION HANDLING
© Dr. Jyoti Lakhani
© Dr. Jyoti Lakhani

More Related Content

What's hot

Procedural programming
Procedural programmingProcedural programming
Procedural programming
Anbarasan Gangadaran
 
Opposites Attract
Opposites AttractOpposites Attract
Opposites Attract
Kevlin Henney
 
Learning Curve
Learning CurveLearning Curve
Learning Curve
Kevlin Henney
 
A Novel Approach for Rule Based Translation of English to Marathi
A Novel Approach for Rule Based Translation of English to MarathiA Novel Approach for Rule Based Translation of English to Marathi
A Novel Approach for Rule Based Translation of English to Marathi
aciijournal
 
11. manuel leiva & juanjo arevalillo (hermes) evaluation of machine translation
11. manuel leiva & juanjo arevalillo (hermes) evaluation of machine translation11. manuel leiva & juanjo arevalillo (hermes) evaluation of machine translation
11. manuel leiva & juanjo arevalillo (hermes) evaluation of machine translationRIILP
 
Protecting JavaScript source code using obfuscation - OWASP Europe Tour 2013 ...
Protecting JavaScript source code using obfuscation - OWASP Europe Tour 2013 ...Protecting JavaScript source code using obfuscation - OWASP Europe Tour 2013 ...
Protecting JavaScript source code using obfuscation - OWASP Europe Tour 2013 ...
AuditMark
 

What's hot (9)

50120140503001
5012014050300150120140503001
50120140503001
 
50120140503001
5012014050300150120140503001
50120140503001
 
Procedural programming
Procedural programmingProcedural programming
Procedural programming
 
Opposites Attract
Opposites AttractOpposites Attract
Opposites Attract
 
Learning Curve
Learning CurveLearning Curve
Learning Curve
 
A Novel Approach for Rule Based Translation of English to Marathi
A Novel Approach for Rule Based Translation of English to MarathiA Novel Approach for Rule Based Translation of English to Marathi
A Novel Approach for Rule Based Translation of English to Marathi
 
Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and looping
 
11. manuel leiva & juanjo arevalillo (hermes) evaluation of machine translation
11. manuel leiva & juanjo arevalillo (hermes) evaluation of machine translation11. manuel leiva & juanjo arevalillo (hermes) evaluation of machine translation
11. manuel leiva & juanjo arevalillo (hermes) evaluation of machine translation
 
Protecting JavaScript source code using obfuscation - OWASP Europe Tour 2013 ...
Protecting JavaScript source code using obfuscation - OWASP Europe Tour 2013 ...Protecting JavaScript source code using obfuscation - OWASP Europe Tour 2013 ...
Protecting JavaScript source code using obfuscation - OWASP Europe Tour 2013 ...
 

Similar to Ds02 flow chart and pseudo code

Ds03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhaniDs03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhani
jyoti_lakhani
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
DivyaKS12
 
Safetty systems intro_embedded_c
Safetty systems intro_embedded_cSafetty systems intro_embedded_c
Safetty systems intro_embedded_c
Maria Cida Rosa
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer ProgrammingProf. Erwin Globio
 
Program logic and design
Program logic and designProgram logic and design
Program logic and designChaffey College
 
Agile development with Ruby
Agile development with RubyAgile development with Ruby
Agile development with Ruby
khelll
 
Introduction to Programming.docx
Introduction to Programming.docxIntroduction to Programming.docx
Introduction to Programming.docx
JohnBrianCatedrilla1
 
sCode optimization
sCode optimizationsCode optimization
sCode optimization
Satyamevjayte Haxor
 
An Efficient Approach to Produce Source Code by Interpreting Algorithm
An Efficient Approach to Produce Source Code by Interpreting AlgorithmAn Efficient Approach to Produce Source Code by Interpreting Algorithm
An Efficient Approach to Produce Source Code by Interpreting Algorithm
IRJET Journal
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review Process
Dr. Syed Hassan Amin
 
Algorithm,Pseudocode,Flowchart.pptx
Algorithm,Pseudocode,Flowchart.pptxAlgorithm,Pseudocode,Flowchart.pptx
Algorithm,Pseudocode,Flowchart.pptx
DrThenmozhiKarunanit
 
Mark asoi ppt
Mark asoi pptMark asoi ppt
Mark asoi pptmark-asoi
 
Switch case looping
Switch case loopingSwitch case looping
Switch case looping
Cherimay Batallones
 
Fundamentals of Programming Lecture #1.pptx
Fundamentals of Programming Lecture #1.pptxFundamentals of Programming Lecture #1.pptx
Fundamentals of Programming Lecture #1.pptx
Eyasu46
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
rajkumar1631010038
 
Class 7 lecture notes
Class 7 lecture notesClass 7 lecture notes
Class 7 lecture notes
Stephen Parsons
 
Chapter 2- Prog101.ppt
Chapter 2- Prog101.pptChapter 2- Prog101.ppt
Chapter 2- Prog101.ppt
JosephObadiahTuray
 
9. Software Implementation
9. Software Implementation9. Software Implementation
9. Software Implementation
ghayour abbas
 

Similar to Ds02 flow chart and pseudo code (20)

Ds03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhaniDs03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhani
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
 
Safetty systems intro_embedded_c
Safetty systems intro_embedded_cSafetty systems intro_embedded_c
Safetty systems intro_embedded_c
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
 
Program logic and design
Program logic and designProgram logic and design
Program logic and design
 
Agile development with Ruby
Agile development with RubyAgile development with Ruby
Agile development with Ruby
 
Introduction to Programming.docx
Introduction to Programming.docxIntroduction to Programming.docx
Introduction to Programming.docx
 
sCode optimization
sCode optimizationsCode optimization
sCode optimization
 
An Efficient Approach to Produce Source Code by Interpreting Algorithm
An Efficient Approach to Produce Source Code by Interpreting AlgorithmAn Efficient Approach to Produce Source Code by Interpreting Algorithm
An Efficient Approach to Produce Source Code by Interpreting Algorithm
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review Process
 
Algorithm,Pseudocode,Flowchart.pptx
Algorithm,Pseudocode,Flowchart.pptxAlgorithm,Pseudocode,Flowchart.pptx
Algorithm,Pseudocode,Flowchart.pptx
 
Mark asoi ppt
Mark asoi pptMark asoi ppt
Mark asoi ppt
 
Switch case looping
Switch case loopingSwitch case looping
Switch case looping
 
MPP-UPNVJ
MPP-UPNVJMPP-UPNVJ
MPP-UPNVJ
 
Fundamentals of Programming Lecture #1.pptx
Fundamentals of Programming Lecture #1.pptxFundamentals of Programming Lecture #1.pptx
Fundamentals of Programming Lecture #1.pptx
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
 
Class 7 lecture notes
Class 7 lecture notesClass 7 lecture notes
Class 7 lecture notes
 
C++ good tutorial
C++ good tutorialC++ good tutorial
C++ good tutorial
 
Chapter 2- Prog101.ppt
Chapter 2- Prog101.pptChapter 2- Prog101.ppt
Chapter 2- Prog101.ppt
 
9. Software Implementation
9. Software Implementation9. Software Implementation
9. Software Implementation
 

More from jyoti_lakhani

CG02 Computer Graphic Systems.ppsx
CG02 Computer Graphic Systems.ppsxCG02 Computer Graphic Systems.ppsx
CG02 Computer Graphic Systems.ppsx
jyoti_lakhani
 
Projections.pptx
Projections.pptxProjections.pptx
Projections.pptx
jyoti_lakhani
 
CG04 Color Models.ppsx
CG04 Color Models.ppsxCG04 Color Models.ppsx
CG04 Color Models.ppsx
jyoti_lakhani
 
CG03 Random Raster Scan displays and Color CRTs.ppsx
CG03 Random Raster Scan displays and Color CRTs.ppsxCG03 Random Raster Scan displays and Color CRTs.ppsx
CG03 Random Raster Scan displays and Color CRTs.ppsx
jyoti_lakhani
 
CG02 Computer Graphic Systems.pptx
CG02 Computer Graphic Systems.pptxCG02 Computer Graphic Systems.pptx
CG02 Computer Graphic Systems.pptx
jyoti_lakhani
 
CG01 introduction.ppsx
CG01 introduction.ppsxCG01 introduction.ppsx
CG01 introduction.ppsx
jyoti_lakhani
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
jyoti_lakhani
 
Double ended queue
Double ended queueDouble ended queue
Double ended queue
jyoti_lakhani
 
Tree terminology and introduction to binary tree
Tree terminology and introduction to binary treeTree terminology and introduction to binary tree
Tree terminology and introduction to binary tree
jyoti_lakhani
 
Priority queue
Priority queuePriority queue
Priority queue
jyoti_lakhani
 
Ds006 linked list- delete from front
Ds006   linked list- delete from frontDs006   linked list- delete from front
Ds006 linked list- delete from front
jyoti_lakhani
 
Ds06 linked list- insert a node after a given node
Ds06   linked list-  insert a node after a given nodeDs06   linked list-  insert a node after a given node
Ds06 linked list- insert a node after a given node
jyoti_lakhani
 
Ds06 linked list- insert a node at end
Ds06   linked list- insert a node at endDs06   linked list- insert a node at end
Ds06 linked list- insert a node at end
jyoti_lakhani
 
Ds06 linked list- insert a node at beginning
Ds06   linked list- insert a node at beginningDs06   linked list- insert a node at beginning
Ds06 linked list- insert a node at beginning
jyoti_lakhani
 
Ds06 linked list- intro and create a node
Ds06   linked list- intro and create a nodeDs06   linked list- intro and create a node
Ds06 linked list- intro and create a node
jyoti_lakhani
 
Ds04 abstract data types (adt) jyoti lakhani
Ds04 abstract data types (adt) jyoti lakhaniDs04 abstract data types (adt) jyoti lakhani
Ds04 abstract data types (adt) jyoti lakhani
jyoti_lakhani
 
Ds03 part i algorithms by jyoti lakhani
Ds03 part i algorithms   by jyoti lakhaniDs03 part i algorithms   by jyoti lakhani
Ds03 part i algorithms by jyoti lakhani
jyoti_lakhani
 
Ds01 data structure introduction - by jyoti lakhani
Ds01 data structure  introduction - by jyoti lakhaniDs01 data structure  introduction - by jyoti lakhani
Ds01 data structure introduction - by jyoti lakhani
jyoti_lakhani
 
Ids 016 cooperative intrusion detection
Ids 016 cooperative intrusion detectionIds 016 cooperative intrusion detection
Ids 016 cooperative intrusion detection
jyoti_lakhani
 
Ids 015 architecture and implementation of ids
Ids 015 architecture and implementation of idsIds 015 architecture and implementation of ids
Ids 015 architecture and implementation of ids
jyoti_lakhani
 

More from jyoti_lakhani (20)

CG02 Computer Graphic Systems.ppsx
CG02 Computer Graphic Systems.ppsxCG02 Computer Graphic Systems.ppsx
CG02 Computer Graphic Systems.ppsx
 
Projections.pptx
Projections.pptxProjections.pptx
Projections.pptx
 
CG04 Color Models.ppsx
CG04 Color Models.ppsxCG04 Color Models.ppsx
CG04 Color Models.ppsx
 
CG03 Random Raster Scan displays and Color CRTs.ppsx
CG03 Random Raster Scan displays and Color CRTs.ppsxCG03 Random Raster Scan displays and Color CRTs.ppsx
CG03 Random Raster Scan displays and Color CRTs.ppsx
 
CG02 Computer Graphic Systems.pptx
CG02 Computer Graphic Systems.pptxCG02 Computer Graphic Systems.pptx
CG02 Computer Graphic Systems.pptx
 
CG01 introduction.ppsx
CG01 introduction.ppsxCG01 introduction.ppsx
CG01 introduction.ppsx
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
Double ended queue
Double ended queueDouble ended queue
Double ended queue
 
Tree terminology and introduction to binary tree
Tree terminology and introduction to binary treeTree terminology and introduction to binary tree
Tree terminology and introduction to binary tree
 
Priority queue
Priority queuePriority queue
Priority queue
 
Ds006 linked list- delete from front
Ds006   linked list- delete from frontDs006   linked list- delete from front
Ds006 linked list- delete from front
 
Ds06 linked list- insert a node after a given node
Ds06   linked list-  insert a node after a given nodeDs06   linked list-  insert a node after a given node
Ds06 linked list- insert a node after a given node
 
Ds06 linked list- insert a node at end
Ds06   linked list- insert a node at endDs06   linked list- insert a node at end
Ds06 linked list- insert a node at end
 
Ds06 linked list- insert a node at beginning
Ds06   linked list- insert a node at beginningDs06   linked list- insert a node at beginning
Ds06 linked list- insert a node at beginning
 
Ds06 linked list- intro and create a node
Ds06   linked list- intro and create a nodeDs06   linked list- intro and create a node
Ds06 linked list- intro and create a node
 
Ds04 abstract data types (adt) jyoti lakhani
Ds04 abstract data types (adt) jyoti lakhaniDs04 abstract data types (adt) jyoti lakhani
Ds04 abstract data types (adt) jyoti lakhani
 
Ds03 part i algorithms by jyoti lakhani
Ds03 part i algorithms   by jyoti lakhaniDs03 part i algorithms   by jyoti lakhani
Ds03 part i algorithms by jyoti lakhani
 
Ds01 data structure introduction - by jyoti lakhani
Ds01 data structure  introduction - by jyoti lakhaniDs01 data structure  introduction - by jyoti lakhani
Ds01 data structure introduction - by jyoti lakhani
 
Ids 016 cooperative intrusion detection
Ids 016 cooperative intrusion detectionIds 016 cooperative intrusion detection
Ids 016 cooperative intrusion detection
 
Ids 015 architecture and implementation of ids
Ids 015 architecture and implementation of idsIds 015 architecture and implementation of ids
Ids 015 architecture and implementation of ids
 

Recently uploaded

Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 

Recently uploaded (20)

Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 

Ds02 flow chart and pseudo code

  • 1. Flow Chart and Pseudo Code © Dr. Jyoti Lakhani
  • 2. The American National Standards Institute (ANSI) set standards for flowcharts and their symbols in the 1960s. The International Organization for Standardization (ISO) adopted the ANSI symbols in 1970. The current standard, ISO 5807, was revised in 1985. Generally, flowcharts flow from top to bottom and left to right. © Dr. Jyoti Lakhani
  • 3. What is a Flowchart? A flowchart is a graphical representations of steps of an Algorithm and programming logic Flowchart Symbols Terminator Process The terminator symbol represents the starting or ending point of the system. A box indicates some particular operation. © Dr. Jyoti Lakhani
  • 4. This represents a printout, such as a document or a report. Document Decision A diamond represents a decision or branching point. Lines coming out from the diamond indicates different possible situations, leading to different sub-processes. Data It represents information entering or leaving the system. An input might be an order from a customer. Output can be a product to be delivered. Lines represent the flow of the sequence and direction of a process. Flow © Dr. Jyoti Lakhani
  • 5. On-Page Reference This symbol would contain a letter inside. It indicates that the flow continues on a matching symbol containing the same letter somewhere else on the same page. This symbol would contain a letter inside. It indicates that the flow continues on a matching symbol containing the same letter somewhere else on a different page. Off-Page Reference Identifies a delay or a bottleneck. Delay or Bottleneck © Dr. Jyoti Lakhani
  • 6. Annotation Indicating additional information about a step in the program. Represented as an open rectangle with a dashed or solid line connecting it to the corresponding symbol in the flowchart Shows named process which is defined elsewhere. Represented as a rectangle with double-struck vertical edges Predefined Process Data File or Database Single documents Multiple documents © Dr. Jyoti Lakhani
  • 7. Manual operation Manual input Preparation or Initialization © Dr. Jyoti Lakhani
  • 8. © Dr. Jyoti Lakhani
  • 9. Calculate Profit and Loss © Dr. Jyoti Lakhani
  • 10. Draw a flowchart to input two numbers from user and display the largest of two numbers © Dr. Jyoti Lakhani
  • 12. © Dr. Jyoti Lakhani An example of Algorithm Algorithm to add two numeric values 1. Declare two variables n1 and n2 2. Read values in n1 and n2 3. Declare one more variable sum 4. Add n1 and n2 and assign result in sum 5. Print sum General English
  • 13. Flow Chart Implementation Algorithm to add two numeric values Start End Input n1 Input n2 Print Sum Sum = n1 + n2 © Dr. Jyoti Lakhani
  • 14. Algorithm Name: Add_Numbers ( n1, n2) Input: Two integers n1 and n2 Output: sum of n1 and n2 Start 1. sum <- n1 + n2 2. Print sum End Pseudo Code Implementation Algorithm to add two numeric values © Dr. Jyoti Lakhani
  • 15. Pseudo code is a simple way of writing programming code in English Pseudo code is simply an implementation of an algorithm in the form of annotations and informative text written in plain English. Pseudo code is not actual programming language It has no syntax like any of the programming language and thus can’t be compiled or interpreted by the computer. Algorithms will often be expressed in pseudo code WHY? WHAT? A mixture of code and English “While understanding pseudo code is usually not difficult, writing it can be a challenge” © Dr. Jyoti Lakhani
  • 16. Why use pseudo code at all? If we write an algorithm in English, the description may be at so high a level that it is difficult to analyze the algorithm and to transform it into code. If instead we write the algorithm in code, we have invested a lot of time in determining the details of an algorithm we may not choose to implement? The GOAL of writing pseudo code, then, is to provide a high-level description of an algorithm which facilitates analysis and eventual coding but at the same time suppresses many of the details that vanish with asymptotic notation © Dr. Jyoti Lakhani
  • 17. Why use pseudo code at all? It allows the designer to focus on the logic of the algorithm without being distracted by details of language syntax. It describe the entire logic of the algorithm so that implementation becomes a rote mechanical task of translating line by line into source code. © Dr. Jyoti Lakhani
  • 18. Here are a few general guidelines for checking your pseudo code: -Naomi Nishimura 1. Mimic good code and good English: It is still important that variable names be mnemonic, comments be included where useful, and English phrases be comprehensible (full sentences are usually not necessary). 2. Ignore unnecessary details: you shouldn’t obsess about syntax at all 3. Arrange the sequence of tasks and write the pseudo code accordingly 4. Aim of the algorithm: Start with the statement of a pseudo code which establishes the main goal or the aim. Example: This program will allow the user to check the number whether it's even or odd. © Dr. Jyoti Lakhani
  • 19. 5. Proper Indentation: The way the if-else, for, while loops are indented in a program, indent the statements likewise, as it helps to comprehend the decision control and execution mechanism. They also improve the readability to a great extent. Example: if "1" print response "I am case 1" if "2" print response "I am case 2". Example: if "1“ print response "I am case 1“ if "2“ print response "I am case 2" © Dr. Jyoti Lakhani
  • 20. 5. Don’t be labor the obvious: In many cases, the type of a variable is clear from context; it is often unnecessary to make it explicit. 6. Take advantage of programming short-hands: Using if-then-else or looping structures is more concise than writing out the equivalent in English; Using parameters in specifying procedures is concise, clear, and accurate, and hence should not be omitted from pseudo code. 7. Use appropriate naming conventions The human tendency follows the approach to follow what we see. If a programmer goes through a pseudo code, his approach will be the same as per it, so the naming must be simple and distinct. © Dr. Jyoti Lakhani
  • 21. 8. Use appropriate Naming Convention: such as Camel Case for methods, upper case for constants and lower case for variables. 9. Elaborate everything which is going to happen in the actual code: Don’t make the pseudo code abstract 10. Use standard programming structures such as ‘if-then’, ‘for’, ‘while’, ‘cases’ the way we use it in programming 11. Check whether all the sections of a pseudo code is complete, finite and clear to understand and comprehend 12. Don’t write the pseudo code in a complete programmatic manner: It is necessary to be simple to understand even for a layman or client, hence don’t incorporate too many technical terms. © Dr. Jyoti Lakhani
  • 22. Advantages of Pseudo code 1. Improves the readability of any approach. It’s one of the best approaches to start implementation of an algorithm 2. Acts as a bridge between the program and the algorithm or flowchart 3. Also works as a rough documentation, so the program of one developer can be understood easily when a pseudo code is written out. In industries, the approach of documentation is essential. And that’s where a pseudo-code proves vital 4. The main goal of a pseudo code is to explain what exactly each line of a program should do, hence making the code construction phase easier for the programmer © Dr. Jyoti Lakhani
  • 23. No broad standard for pseudo code syntax exists, as a program in pseudocode is not an executable program, however certain limited standards exist Pseudo code resembles skeleton programs which can be compiled without errors. Flowcharts, drakon-charts and Unified Modelling Language (UML) charts can be thought of as a graphical alternative to pseudo code, but are more spacious on paper. Languages such as HAGGIS bridge the gap between pseudo code and code written in programming languages. - Wiki © Dr. Jyoti Lakhani
  • 24. Type of operation Symbol Example Assignment ← or := c ← 2πr, c := 2πr Comparison =, ≠, <, >, ≤, ≥ Arithmetic +, −, ×, /, mod Floor/ceiling ⌊, ⌋, ⌈, ⌉ a ← ⌊b⌋ + ⌈c⌉ Logical and, or Sums, products Σ Π h ← Σa∈A 1/a Some Conventions to write Pseudo Code - Wiki © Dr. Jyoti Lakhani
  • 25. Common Action Keywords: Input: READ OBTAIN GET Output: PRINT DISPLAY SHOW Compute: COMPUTE CALCULATE DETERMINE Initialize: SET INIT Add one: INCREMENT BUMP Action Words © Dr. Jyoti Lakhani
  • 26. IF-THEN-ELSE The general form is: IF condition THEN sequence 1 ELSE sequence 2 ENDIF IF HoursWorked > NormalMax THEN Display overtime message ELSE Display regular time message ENDIF Example: © Dr. Jyoti Lakhani
  • 27. WHILE The general form is: WHILE condition sequence ENDWHILE The loop is entered only if the condition is true. WHILE Population < LimitCompute Population as Population + Births – Deaths ENDWHILE © Dr. Jyoti Lakhani
  • 28. CASE The general form is: CASE expression OF condition 1 : sequence 1 condition 2 : sequence 2 ... condition n : sequence n OTHERS: default sequence ENDCASE CASE grade OF A : points = 4 B : points = 3 C : points = 2 D : points = 1 OTHERS : points = 5 ENDCASE © Dr. Jyoti Lakhani
  • 29. FOR The general form is: FOR iteration bounds sequence ENDFOR Example: FOR each month of the year (good) FOR month = 1 to 12 (ok) FOR each employee in the list (good) FOR empno = 1 to listsize (ok) © Dr. Jyoti Lakhani
  • 30. REPEAT-UNTIL The general form is: REPEAT sequence UNTIL condition NESTED CONSTRUCTS Example: SET total to zero REPEAT READ Temperature IF Temperature > Freezing THEN INCREMENT total END IF UNTIL Temperature < zero © Dr. Jyoti Lakhani
  • 31. INVOKING SUBPROCEDURES Use the CALL keyword. For example: CALL AvgAge with StudentAges CALL Swap (CurrentItem, TargetItem) CALL getBalance RETURNING aBalance BEGIN statements EXCEPTION WHEN exception type statements to handle exception WHEN another exception type statements to handle exception END EXCEPTION HANDLING © Dr. Jyoti Lakhani
  • 32. © Dr. Jyoti Lakhani