SlideShare a Scribd company logo
ALGORITHMS AND FLOW
CHARTS
By
Chinnu Edwin A
M.Tech. CS
Introduction
A typical programming task can be divided into two phases:
Problem solving phase
• produce an ordered sequence of steps that describe solution of
problem
• This sequence of steps is called an algorithm
Implementation phase
•to implement the program in some programming language
STEPS IN PROBLEM SOLVING
• First produce a general algorithm (one can use pseudocode)
• Refine the algorithm successively to get step by step detailed
algorithm that is very close to a computer language.
• Pseudocode is an artificial and informal language that helps
programmers develop algorithms.
• Pseudocode is very similar to everyday English.
Pseudocode Example
• Example 1: Write an algorithm to determine a student’s final grade
and indicate whether it is passing or failing. The final grade is
calculated as the average of four marks.
• Pseudocode:
Input a set of 4 marks
Calculate their average by summing and dividing by 4
if average is below 50
Print “FAIL”
else
Print “PASS”
ALGORITHMS
 Definition
• In programming, algorithm is a set of well defined instructions in
sequence to solve the problem.
 Qualities of a good algorithm
1.Input and output should be defined precisely.
2.Each steps in algorithm should be clear and unambiguous.
3.Algorithm should be most effective among many different ways to
solve a problem.
4.An algorithm shouldn’t have computer code. Instead, the algorithm
should be written in such a way that, it can be used in similar
programming languages.
Examples Of Algorithms
• Example : Write an algorithm to determine a student’s final grade and indicate whether
it is passing or failing. The final grade is calculated as the average of four marks.
• Detailed Algorithm
Step 1: Start
Step 2: Input M1,M2,M3,M4
Step 3: GRADE <- (M1+M2+M3+M4)/4
Step 4: if (GRADE < 50) then
Print “FAIL”
else
Print “PASS”
Step 5: Stop;
Examples Of Algorithms
(contd..)
• Write an algorithm to add two numbers entered by user.
Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values num1 and num2.
Step 4: Add num1 and num2 and assign the result to sum.
sum←num1+num2
Step 5: Display sum
Step 6: Stop
Advantages of Algorithm
1.It is a step-wise representation of a solution to a given problem,
which makes it easy to understand.
2.An algorithm uses a definite procedure.
3.It is not dependent on any programming language, so it is
easy to understand for anyone even without programming
knowledge.
4.Every step in an algorithm has its own logical sequence so it
is easy to debug.
5.By using algorithm, the problem is broken down into smaller
pieces or steps hence, it is easier for programmer to
convert it into an actual program
Disadvantages of Algorithm
1.Writing algorithm takes a long time.
2.An Algorithm is not a computer program, it is rather a concept
of how a program should be.
FLOWCHART
• A flowchart is a type of diagram that represents an
algorithm, workflow or process
• The flowchart shows the steps as boxes of various kinds, and
their order by connecting the boxes with arrows.
• Flowcharts are used in analyzing, designing, documenting
or managing a process or program in various fields.
FLOWCHART SYMBOLS
• Flowcharts use special shapes to represent different types of
actions or steps in a process.
• Lines and arrows show the sequence of the steps, and the
relationships among them.
• These are known as flowchart symbols.
Common Flowchart Symbols
• Rectangle Shape – Represents a process
• Oval or Pill Shape – Represents the start or end
• Diamond Shape – Represents a decision
• Parallelogram – Represents input/output
Common Flowchart Symbols
(CONTD..)
Advantages of Flowchart
1.The Flowchart is an excellent way of communicating the logic of
a program.
2.It is easy and efficient to analyze problem using flowchart.
3.During program development cycle, the flowchart plays the role of
a guide or a blueprint which makes program development
process easier.
4.After successful development of a program, it needs continuous
timely maintenance during the course of its operation. The flowchart
makes program or system maintenance easier.
5.It helps the programmer to write the program code.
6.It is easy to convert the flowchart into any programming
language code as it does not use any specific programming
language concept.
Disadvantages of flowchart
1.The flowchart can be complex when the logic of a program is quite
complicated.
2.Drawing flowchart is a time-consuming task.
3.Difficult to alter the flowchart. Sometimes, the designer needs to
redraw the complete flowchart to change the logic of the flowchart or
to alter the flowchart.
4.Since it uses special sets of symbols for every action, it is quite a
tedious task to develop a flowchart as it requires special tools to
draw the necessary symbols.
5.In the case of a complex flowchart, other programmers might have
a difficult time understanding the logic and process of the
flowchart.
6.It is just a visualization of a program, it cannot function like an
actual program
Examples
Write a pseudocode, an algorithm and draw a flowchart that will read
the radius of a circle and calculate its area.
Pseudocode
• Input the radius of circle , r
• Calculate the Area by using the formula , Area= 3.14 * r *r
• Print Area
Examples (contd..)
Algorithm
• Step1: Start
• Step 2: Input radius, r
• Step 3: Area = 3.14 * r*r
• Step 4: Print Area
• Step 5: Stop
Examples (contd..)
• Flowchart
Algorithms and flow charts
Ad

More Related Content

What's hot (20)

programming type error
programming type errorprogramming type error
programming type error
Walepak Ubi
 
Introduction to basic programming
Introduction to basic programmingIntroduction to basic programming
Introduction to basic programming
Jordan Delacruz
 
Programming language
Programming languageProgramming language
Programming language
zeshmaiqbal
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowcharts
Samuel Igbanogu
 
Clase de algoritmos
Clase de algoritmosClase de algoritmos
Clase de algoritmos
Sol Hernández
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
Abha Damani
 
Programming process and flowchart
Programming process and flowchartProgramming process and flowchart
Programming process and flowchart
hermiraguilar
 
Lesson 3
Lesson 3Lesson 3
Lesson 3
Dr. Rupinder Singh
 
Flow chart
Flow chartFlow chart
Flow chart
Kawsar Ahmed
 
Introduction to algorithms
Introduction to algorithmsIntroduction to algorithms
Introduction to algorithms
subhashchandra197
 
Algorithm and Flowcharts
Algorithm and FlowchartsAlgorithm and Flowcharts
Algorithm and Flowcharts
Dr. SURBHI SAROHA
 
2 problem solving and programming workbook by inqilab patel
2 problem solving and programming workbook by inqilab patel2 problem solving and programming workbook by inqilab patel
2 problem solving and programming workbook by inqilab patel
Inqilab Patel
 
Activity diagrams
Activity diagramsActivity diagrams
Activity diagrams
Jalaxy Jahury
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
rajkumar1631010038
 
Lecture 5 - Structured Programming Language
Lecture 5 - Structured Programming Language Lecture 5 - Structured Programming Language
Lecture 5 - Structured Programming Language
Md. Imran Hossain Showrov
 
Assembler
AssemblerAssembler
Assembler
Temesgen Molla
 
Software process and project metrics
Software process and project metricsSoftware process and project metrics
Software process and project metrics
Indu Sharma Bhardwaj
 
2.1.1 PROBLEM SOLVING & DESIGN
2.1.1 PROBLEM SOLVING & DESIGN2.1.1 PROBLEM SOLVING & DESIGN
2.1.1 PROBLEM SOLVING & DESIGN
Buxoo Abdullah
 
State chart diagram
State chart diagramState chart diagram
State chart diagram
Preeti Mishra
 
Compiler Design Introduction
Compiler Design IntroductionCompiler Design Introduction
Compiler Design Introduction
Richa Sharma
 
programming type error
programming type errorprogramming type error
programming type error
Walepak Ubi
 
Introduction to basic programming
Introduction to basic programmingIntroduction to basic programming
Introduction to basic programming
Jordan Delacruz
 
Programming language
Programming languageProgramming language
Programming language
zeshmaiqbal
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowcharts
Samuel Igbanogu
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
Abha Damani
 
Programming process and flowchart
Programming process and flowchartProgramming process and flowchart
Programming process and flowchart
hermiraguilar
 
2 problem solving and programming workbook by inqilab patel
2 problem solving and programming workbook by inqilab patel2 problem solving and programming workbook by inqilab patel
2 problem solving and programming workbook by inqilab patel
Inqilab Patel
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
rajkumar1631010038
 
Lecture 5 - Structured Programming Language
Lecture 5 - Structured Programming Language Lecture 5 - Structured Programming Language
Lecture 5 - Structured Programming Language
Md. Imran Hossain Showrov
 
Software process and project metrics
Software process and project metricsSoftware process and project metrics
Software process and project metrics
Indu Sharma Bhardwaj
 
2.1.1 PROBLEM SOLVING & DESIGN
2.1.1 PROBLEM SOLVING & DESIGN2.1.1 PROBLEM SOLVING & DESIGN
2.1.1 PROBLEM SOLVING & DESIGN
Buxoo Abdullah
 
Compiler Design Introduction
Compiler Design IntroductionCompiler Design Introduction
Compiler Design Introduction
Richa Sharma
 

Similar to Algorithms and flow charts (20)

Fundamental of Information Technology - UNIT 6
Fundamental of Information Technology - UNIT 6Fundamental of Information Technology - UNIT 6
Fundamental of Information Technology - UNIT 6
Shipra Swati
 
Lesson 1 of c programming algorithms and flowcharts.pptx
Lesson 1 of c programming algorithms and flowcharts.pptxLesson 1 of c programming algorithms and flowcharts.pptx
Lesson 1 of c programming algorithms and flowcharts.pptx
AlinaMishra7
 
algorithms and flow chart overview.pdf
algorithms and flow chart overview.pdfalgorithms and flow chart overview.pdf
algorithms and flow chart overview.pdf
AmanPratik11
 
Python Unit 1.pdfPython Notes for Bharathiar university syllabus
Python Unit 1.pdfPython Notes for Bharathiar university syllabusPython Unit 1.pdfPython Notes for Bharathiar university syllabus
Python Unit 1.pdfPython Notes for Bharathiar university syllabus
ANUSUYA S
 
Algorithm defination, design & Implementation
Algorithm defination, design & ImplementationAlgorithm defination, design & Implementation
Algorithm defination, design & Implementation
Bilal Maqbool ツ
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
flowchart & algorithms
flowchart & algorithmsflowchart & algorithms
flowchart & algorithms
Student
 
Algorithms and Flowchart for IGCSE Students
Algorithms and Flowchart for IGCSE StudentsAlgorithms and Flowchart for IGCSE Students
Algorithms and Flowchart for IGCSE Students
MKKhaing
 
Flowcharting and Algorithm
Flowcharting and Algorithm Flowcharting and Algorithm
Flowcharting and Algorithm
Zeinna Belle Desamito
 
FLOWCHARTS.pptx
FLOWCHARTS.pptxFLOWCHARTS.pptx
FLOWCHARTS.pptx
Srinivas Kanakala
 
Algorithm & Flowchart.pdf
Algorithm & Flowchart.pdfAlgorithm & Flowchart.pdf
Algorithm & Flowchart.pdf
Vpmv
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem sloving
Mani Kandan
 
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
BCE L-2 Algorithms-and-Flowchart-ppt.pptBCE L-2 Algorithms-and-Flowchart-ppt.ppt
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
Kirti Verma
 
Unit 1(1).pptx Program Logic Development
Unit 1(1).pptx Program Logic DevelopmentUnit 1(1).pptx Program Logic Development
Unit 1(1).pptx Program Logic Development
Vaibhav Parjane
 
Chap6
Chap6Chap6
Chap6
artipradhan
 
Algorithm and flowchart.pptx
Algorithm and flowchart.pptxAlgorithm and flowchart.pptx
Algorithm and flowchart.pptx
MaheShiva
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
dipti reya
 
256958.ppt
256958.ppt256958.ppt
256958.ppt
Bimlesh7
 
ALGORITHM PPT GUIDE.pdf
ALGORITHM PPT GUIDE.pdfALGORITHM PPT GUIDE.pdf
ALGORITHM PPT GUIDE.pdf
meychu1
 
Algorithmics, intro to data structures.pptx
Algorithmics,  intro to data structures.pptxAlgorithmics,  intro to data structures.pptx
Algorithmics, intro to data structures.pptx
OntopScenes
 
Fundamental of Information Technology - UNIT 6
Fundamental of Information Technology - UNIT 6Fundamental of Information Technology - UNIT 6
Fundamental of Information Technology - UNIT 6
Shipra Swati
 
Lesson 1 of c programming algorithms and flowcharts.pptx
Lesson 1 of c programming algorithms and flowcharts.pptxLesson 1 of c programming algorithms and flowcharts.pptx
Lesson 1 of c programming algorithms and flowcharts.pptx
AlinaMishra7
 
algorithms and flow chart overview.pdf
algorithms and flow chart overview.pdfalgorithms and flow chart overview.pdf
algorithms and flow chart overview.pdf
AmanPratik11
 
Python Unit 1.pdfPython Notes for Bharathiar university syllabus
Python Unit 1.pdfPython Notes for Bharathiar university syllabusPython Unit 1.pdfPython Notes for Bharathiar university syllabus
Python Unit 1.pdfPython Notes for Bharathiar university syllabus
ANUSUYA S
 
Algorithm defination, design & Implementation
Algorithm defination, design & ImplementationAlgorithm defination, design & Implementation
Algorithm defination, design & Implementation
Bilal Maqbool ツ
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
flowchart & algorithms
flowchart & algorithmsflowchart & algorithms
flowchart & algorithms
Student
 
Algorithms and Flowchart for IGCSE Students
Algorithms and Flowchart for IGCSE StudentsAlgorithms and Flowchart for IGCSE Students
Algorithms and Flowchart for IGCSE Students
MKKhaing
 
Algorithm & Flowchart.pdf
Algorithm & Flowchart.pdfAlgorithm & Flowchart.pdf
Algorithm & Flowchart.pdf
Vpmv
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem sloving
Mani Kandan
 
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
BCE L-2 Algorithms-and-Flowchart-ppt.pptBCE L-2 Algorithms-and-Flowchart-ppt.ppt
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
Kirti Verma
 
Unit 1(1).pptx Program Logic Development
Unit 1(1).pptx Program Logic DevelopmentUnit 1(1).pptx Program Logic Development
Unit 1(1).pptx Program Logic Development
Vaibhav Parjane
 
Algorithm and flowchart.pptx
Algorithm and flowchart.pptxAlgorithm and flowchart.pptx
Algorithm and flowchart.pptx
MaheShiva
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
dipti reya
 
256958.ppt
256958.ppt256958.ppt
256958.ppt
Bimlesh7
 
ALGORITHM PPT GUIDE.pdf
ALGORITHM PPT GUIDE.pdfALGORITHM PPT GUIDE.pdf
ALGORITHM PPT GUIDE.pdf
meychu1
 
Algorithmics, intro to data structures.pptx
Algorithmics,  intro to data structures.pptxAlgorithmics,  intro to data structures.pptx
Algorithmics, intro to data structures.pptx
OntopScenes
 
Ad

Recently uploaded (20)

plataforma virtual E learning y sus características.pdf
plataforma virtual E learning y sus características.pdfplataforma virtual E learning y sus características.pdf
plataforma virtual E learning y sus características.pdf
valdiviesovaleriamis
 
hy 2wdduv.pptxdcsvdbjdvbjhdvbjhdbvjhvdsvs
hy  2wdduv.pptxdcsvdbjdvbjhdvbjhdbvjhvdsvshy  2wdduv.pptxdcsvdbjdvbjhdvbjhdbvjhvdsvs
hy 2wdduv.pptxdcsvdbjdvbjhdvbjhdbvjhvdsvs
saimahadeshdigikit
 
35 Must-Have WordPress Plugins to Power Your Website in 2025
35 Must-Have WordPress Plugins to Power Your Website in 202535 Must-Have WordPress Plugins to Power Your Website in 2025
35 Must-Have WordPress Plugins to Power Your Website in 2025
steve198109
 
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdfGiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
Giacomo Vacca
 
The AI Research Showdown: Perplexity vs Gemini
The AI Research Showdown: Perplexity vs GeminiThe AI Research Showdown: Perplexity vs Gemini
The AI Research Showdown: Perplexity vs Gemini
Abel Akara Ticha
 
an overview of information systems .ppt
an overview of  information systems .pptan overview of  information systems .ppt
an overview of information systems .ppt
DominicWaweru
 
Big_fat_report_from Kaspersky_IR_Report_2024.pdf
Big_fat_report_from Kaspersky_IR_Report_2024.pdfBig_fat_report_from Kaspersky_IR_Report_2024.pdf
Big_fat_report_from Kaspersky_IR_Report_2024.pdf
avreyjeyson
 
30 Best WooCommerce Plugins to Boost Your Online Store in 2025
30 Best WooCommerce Plugins to Boost Your Online Store in 202530 Best WooCommerce Plugins to Boost Your Online Store in 2025
30 Best WooCommerce Plugins to Boost Your Online Store in 2025
steve198109
 
Paper: World Game (s) Great Redesign.pdf
Paper: World Game (s) Great Redesign.pdfPaper: World Game (s) Great Redesign.pdf
Paper: World Game (s) Great Redesign.pdf
Steven McGee
 
introduction to html and cssIntroHTML.ppt
introduction to html and cssIntroHTML.pptintroduction to html and cssIntroHTML.ppt
introduction to html and cssIntroHTML.ppt
SherifElGohary7
 
The Hidden Risks of Hiring Hackers to Change Grades: An Awareness Guide
The Hidden Risks of Hiring Hackers to Change Grades: An Awareness GuideThe Hidden Risks of Hiring Hackers to Change Grades: An Awareness Guide
The Hidden Risks of Hiring Hackers to Change Grades: An Awareness Guide
russellpeter1995
 
Regional Development for an Open, Stable, and Secure Internet
Regional Development for an Open, Stable, and Secure InternetRegional Development for an Open, Stable, and Secure Internet
Regional Development for an Open, Stable, and Secure Internet
APNIC
 
OS-deadlock detection and recovery with additional features.ppt
OS-deadlock detection and recovery with additional features.pptOS-deadlock detection and recovery with additional features.ppt
OS-deadlock detection and recovery with additional features.ppt
Mangala R
 
Enums In the Wild at PHP[tek] Conference 2025
Enums In the Wild at PHP[tek] Conference 2025Enums In the Wild at PHP[tek] Conference 2025
Enums In the Wild at PHP[tek] Conference 2025
Dana Luther
 
Java developer-friendly frontends: Build UIs without the JavaScript hassle- JCON
Java developer-friendly frontends: Build UIs without the JavaScript hassle- JCONJava developer-friendly frontends: Build UIs without the JavaScript hassle- JCON
Java developer-friendly frontends: Build UIs without the JavaScript hassle- JCON
Jago de Vreede
 
Web3_Metaverse_Foundations - DTW Coppenhagen - FINAL - 230919.pdf
Web3_Metaverse_Foundations - DTW Coppenhagen - FINAL - 230919.pdfWeb3_Metaverse_Foundations - DTW Coppenhagen - FINAL - 230919.pdf
Web3_Metaverse_Foundations - DTW Coppenhagen - FINAL - 230919.pdf
Michael Lesniak
 
DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...
DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...
DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...
werhkr1
 
Prop-154: Resizing of IPv4 assignments for IXPs
Prop-154: Resizing of IPv4 assignments for IXPsProp-154: Resizing of IPv4 assignments for IXPs
Prop-154: Resizing of IPv4 assignments for IXPs
APNIC
 
TAIPAN99 PUSAT GAME AMAN DAN TERGACOR SE ASIA
TAIPAN99 PUSAT GAME AMAN DAN TERGACOR SE ASIATAIPAN99 PUSAT GAME AMAN DAN TERGACOR SE ASIA
TAIPAN99 PUSAT GAME AMAN DAN TERGACOR SE ASIA
TAIPAN 99
 
Save TikTok Video Without Watermark - Tikcd
Save TikTok Video Without Watermark - TikcdSave TikTok Video Without Watermark - Tikcd
Save TikTok Video Without Watermark - Tikcd
Tikcd
 
plataforma virtual E learning y sus características.pdf
plataforma virtual E learning y sus características.pdfplataforma virtual E learning y sus características.pdf
plataforma virtual E learning y sus características.pdf
valdiviesovaleriamis
 
hy 2wdduv.pptxdcsvdbjdvbjhdvbjhdbvjhvdsvs
hy  2wdduv.pptxdcsvdbjdvbjhdvbjhdbvjhvdsvshy  2wdduv.pptxdcsvdbjdvbjhdvbjhdbvjhvdsvs
hy 2wdduv.pptxdcsvdbjdvbjhdvbjhdbvjhvdsvs
saimahadeshdigikit
 
35 Must-Have WordPress Plugins to Power Your Website in 2025
35 Must-Have WordPress Plugins to Power Your Website in 202535 Must-Have WordPress Plugins to Power Your Website in 2025
35 Must-Have WordPress Plugins to Power Your Website in 2025
steve198109
 
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdfGiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
Giacomo Vacca
 
The AI Research Showdown: Perplexity vs Gemini
The AI Research Showdown: Perplexity vs GeminiThe AI Research Showdown: Perplexity vs Gemini
The AI Research Showdown: Perplexity vs Gemini
Abel Akara Ticha
 
an overview of information systems .ppt
an overview of  information systems .pptan overview of  information systems .ppt
an overview of information systems .ppt
DominicWaweru
 
Big_fat_report_from Kaspersky_IR_Report_2024.pdf
Big_fat_report_from Kaspersky_IR_Report_2024.pdfBig_fat_report_from Kaspersky_IR_Report_2024.pdf
Big_fat_report_from Kaspersky_IR_Report_2024.pdf
avreyjeyson
 
30 Best WooCommerce Plugins to Boost Your Online Store in 2025
30 Best WooCommerce Plugins to Boost Your Online Store in 202530 Best WooCommerce Plugins to Boost Your Online Store in 2025
30 Best WooCommerce Plugins to Boost Your Online Store in 2025
steve198109
 
Paper: World Game (s) Great Redesign.pdf
Paper: World Game (s) Great Redesign.pdfPaper: World Game (s) Great Redesign.pdf
Paper: World Game (s) Great Redesign.pdf
Steven McGee
 
introduction to html and cssIntroHTML.ppt
introduction to html and cssIntroHTML.pptintroduction to html and cssIntroHTML.ppt
introduction to html and cssIntroHTML.ppt
SherifElGohary7
 
The Hidden Risks of Hiring Hackers to Change Grades: An Awareness Guide
The Hidden Risks of Hiring Hackers to Change Grades: An Awareness GuideThe Hidden Risks of Hiring Hackers to Change Grades: An Awareness Guide
The Hidden Risks of Hiring Hackers to Change Grades: An Awareness Guide
russellpeter1995
 
Regional Development for an Open, Stable, and Secure Internet
Regional Development for an Open, Stable, and Secure InternetRegional Development for an Open, Stable, and Secure Internet
Regional Development for an Open, Stable, and Secure Internet
APNIC
 
OS-deadlock detection and recovery with additional features.ppt
OS-deadlock detection and recovery with additional features.pptOS-deadlock detection and recovery with additional features.ppt
OS-deadlock detection and recovery with additional features.ppt
Mangala R
 
Enums In the Wild at PHP[tek] Conference 2025
Enums In the Wild at PHP[tek] Conference 2025Enums In the Wild at PHP[tek] Conference 2025
Enums In the Wild at PHP[tek] Conference 2025
Dana Luther
 
Java developer-friendly frontends: Build UIs without the JavaScript hassle- JCON
Java developer-friendly frontends: Build UIs without the JavaScript hassle- JCONJava developer-friendly frontends: Build UIs without the JavaScript hassle- JCON
Java developer-friendly frontends: Build UIs without the JavaScript hassle- JCON
Jago de Vreede
 
Web3_Metaverse_Foundations - DTW Coppenhagen - FINAL - 230919.pdf
Web3_Metaverse_Foundations - DTW Coppenhagen - FINAL - 230919.pdfWeb3_Metaverse_Foundations - DTW Coppenhagen - FINAL - 230919.pdf
Web3_Metaverse_Foundations - DTW Coppenhagen - FINAL - 230919.pdf
Michael Lesniak
 
DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...
DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...
DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...
werhkr1
 
Prop-154: Resizing of IPv4 assignments for IXPs
Prop-154: Resizing of IPv4 assignments for IXPsProp-154: Resizing of IPv4 assignments for IXPs
Prop-154: Resizing of IPv4 assignments for IXPs
APNIC
 
TAIPAN99 PUSAT GAME AMAN DAN TERGACOR SE ASIA
TAIPAN99 PUSAT GAME AMAN DAN TERGACOR SE ASIATAIPAN99 PUSAT GAME AMAN DAN TERGACOR SE ASIA
TAIPAN99 PUSAT GAME AMAN DAN TERGACOR SE ASIA
TAIPAN 99
 
Save TikTok Video Without Watermark - Tikcd
Save TikTok Video Without Watermark - TikcdSave TikTok Video Without Watermark - Tikcd
Save TikTok Video Without Watermark - Tikcd
Tikcd
 
Ad

Algorithms and flow charts

  • 2. Introduction A typical programming task can be divided into two phases: Problem solving phase • produce an ordered sequence of steps that describe solution of problem • This sequence of steps is called an algorithm Implementation phase •to implement the program in some programming language
  • 3. STEPS IN PROBLEM SOLVING • First produce a general algorithm (one can use pseudocode) • Refine the algorithm successively to get step by step detailed algorithm that is very close to a computer language. • Pseudocode is an artificial and informal language that helps programmers develop algorithms. • Pseudocode is very similar to everyday English.
  • 4. Pseudocode Example • Example 1: Write an algorithm to determine a student’s final grade and indicate whether it is passing or failing. The final grade is calculated as the average of four marks. • Pseudocode: Input a set of 4 marks Calculate their average by summing and dividing by 4 if average is below 50 Print “FAIL” else Print “PASS”
  • 5. ALGORITHMS  Definition • In programming, algorithm is a set of well defined instructions in sequence to solve the problem.  Qualities of a good algorithm 1.Input and output should be defined precisely. 2.Each steps in algorithm should be clear and unambiguous. 3.Algorithm should be most effective among many different ways to solve a problem. 4.An algorithm shouldn’t have computer code. Instead, the algorithm should be written in such a way that, it can be used in similar programming languages.
  • 6. Examples Of Algorithms • Example : Write an algorithm to determine a student’s final grade and indicate whether it is passing or failing. The final grade is calculated as the average of four marks. • Detailed Algorithm Step 1: Start Step 2: Input M1,M2,M3,M4 Step 3: GRADE <- (M1+M2+M3+M4)/4 Step 4: if (GRADE < 50) then Print “FAIL” else Print “PASS” Step 5: Stop;
  • 7. Examples Of Algorithms (contd..) • Write an algorithm to add two numbers entered by user. Step 1: Start Step 2: Declare variables num1, num2 and sum. Step 3: Read values num1 and num2. Step 4: Add num1 and num2 and assign the result to sum. sum←num1+num2 Step 5: Display sum Step 6: Stop
  • 8. Advantages of Algorithm 1.It is a step-wise representation of a solution to a given problem, which makes it easy to understand. 2.An algorithm uses a definite procedure. 3.It is not dependent on any programming language, so it is easy to understand for anyone even without programming knowledge. 4.Every step in an algorithm has its own logical sequence so it is easy to debug. 5.By using algorithm, the problem is broken down into smaller pieces or steps hence, it is easier for programmer to convert it into an actual program
  • 9. Disadvantages of Algorithm 1.Writing algorithm takes a long time. 2.An Algorithm is not a computer program, it is rather a concept of how a program should be.
  • 10. FLOWCHART • A flowchart is a type of diagram that represents an algorithm, workflow or process • The flowchart shows the steps as boxes of various kinds, and their order by connecting the boxes with arrows. • Flowcharts are used in analyzing, designing, documenting or managing a process or program in various fields.
  • 11. FLOWCHART SYMBOLS • Flowcharts use special shapes to represent different types of actions or steps in a process. • Lines and arrows show the sequence of the steps, and the relationships among them. • These are known as flowchart symbols.
  • 12. Common Flowchart Symbols • Rectangle Shape – Represents a process • Oval or Pill Shape – Represents the start or end • Diamond Shape – Represents a decision • Parallelogram – Represents input/output
  • 14. Advantages of Flowchart 1.The Flowchart is an excellent way of communicating the logic of a program. 2.It is easy and efficient to analyze problem using flowchart. 3.During program development cycle, the flowchart plays the role of a guide or a blueprint which makes program development process easier. 4.After successful development of a program, it needs continuous timely maintenance during the course of its operation. The flowchart makes program or system maintenance easier. 5.It helps the programmer to write the program code. 6.It is easy to convert the flowchart into any programming language code as it does not use any specific programming language concept.
  • 15. Disadvantages of flowchart 1.The flowchart can be complex when the logic of a program is quite complicated. 2.Drawing flowchart is a time-consuming task. 3.Difficult to alter the flowchart. Sometimes, the designer needs to redraw the complete flowchart to change the logic of the flowchart or to alter the flowchart. 4.Since it uses special sets of symbols for every action, it is quite a tedious task to develop a flowchart as it requires special tools to draw the necessary symbols. 5.In the case of a complex flowchart, other programmers might have a difficult time understanding the logic and process of the flowchart. 6.It is just a visualization of a program, it cannot function like an actual program
  • 16. Examples Write a pseudocode, an algorithm and draw a flowchart that will read the radius of a circle and calculate its area. Pseudocode • Input the radius of circle , r • Calculate the Area by using the formula , Area= 3.14 * r *r • Print Area
  • 17. Examples (contd..) Algorithm • Step1: Start • Step 2: Input radius, r • Step 3: Area = 3.14 * r*r • Step 4: Print Area • Step 5: Stop