SlideShare a Scribd company logo
WHAT IS AN ALGORITHM?
It is a set of instructions of how to carry out a process. An algorithm lists the steps that must
be followed to complete the process and to reach the solution
Examples:
• A knitting pattern
• A set of instructions telling you how to put a kit together (eg. an kitchen unit)
• A recipe in a cook book
• An algorithm can be represented diagrammatically in the form of a flow chart.
Algorithm constructions:
There are three different constructions of algorithms.
Properties of Algorithms:
• An algorithm is an exact specification of how to solve a computational problem
• An algorithm must specify every step completely, so a computer can implement it
without any further “understanding”
• An algorithm must work for all possible inputs of the problem.
• Algorithms must be:
 Correct: For each input produce an appropriate output
 Efficient: run as quickly as possible, and use as little memory as possible – more
about this later
• There can be many different algorithms for each computational problem.
Algorithms Phases:
A typical programming task can be divided into two phases:
1. Problem solving phase (Designing)
• produce an ordered sequence of steps that describe solution of problem
• this sequence of steps is called an algorithm
2. Implementation phase
• implement the program in some programming language
Problem solving phase (Designing) :
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”
The Flowchart:
• (Dictionary) A schematic representation of a sequence of operations, as in a
manufacturing process or computer program.
• (Technical) A graphical representation of the sequence of operations in an
information system or program. Information system flowcharts show how data flows
from source documents through the computer to final distribution to users. Program
flowcharts show the sequence of instructions in a single program or subroutine.
Different symbols are used to draw each type of flowchart.
• shows logic of an algorithm
• emphasizes individual steps and their interconnections
• e.g. control flow from one action to the next
Flowchart Symbols:
• A flowchart consists of a sequence of instructions linked together by arrows to show
the order in which the instructions must be carried out.
• It provides detailed steps.
• Each instruction is put into a box. The boxes are different shapes depending upon
what the instruction is.
Oval
Parallelogram
Rectangle
Diamond
Hybrid
Name Symbol Use in Flowchart
Denotes the beginning or end of the program
Denotes an input operation
Denotes an output operation
Denotes a decision (or branch) to be made.
The program should continue along one of
two routes. (e.g. IF/THEN/ELSE)
Denotes a process to be carried out
e.g. addition, subtraction, division etc.
Flow line Denotes the direction of logic flow in the program
Example 1:
MAKING A CUP OF TEA!
Pseudocode:
1. Take tea bag out of cup
2. Boil the water
3. Put tea bag in cup
4. Add milk?
5. Pour boiling water in cup
6. Fill kettle
7. Stir
8. Ready
9. Add sugar ?
10. Fetch cup
Algorithm:
1. Fill kettle
2. Boil the water
3. Fetch cup
4. Put tea bag in cup
5. Pour boiling water in cup
6. Take tea bag out of cup
7. Add sugar ?
8. Stir
9. Add milk?
10. Stir
11. Ready
Example 2:
Grade students to identify pass & fail.
Algorithm:
Step 1: Input M1,M2,M3,M4
Step 2: GRADE  (M1+M2+M3+M4)/4
Step 3: if (GRADE <50) then
Print “FAIL”
else
Print “PASS”
endif
Example 3
Write an algorithm and draw a flowchart that will read the two sides of a rectangle and
calculate its area.
Pseudocode
1. Input the width (W) and Length (L) of a rectangle
2. Calculate the area (A) by multiplying L with W
3. Print A
Algorithm
Step 1: Input W,L
Step 2: A  L x W
Step 3: Print A
Pseudocode for three constructs:
Flowcharts for three constructs
Ad

More Related Content

What's hot (20)

Algorithm Design & Implementation
Algorithm Design & ImplementationAlgorithm Design & Implementation
Algorithm Design & Implementation
Gaditek
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
Rabin BK
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
Akhil Kaushik
 
Basic of compiler
Basic of compiler Basic of compiler
Basic of compiler
Abhishek Singh
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
Dhaval Kaneria
 
Algorithm
AlgorithmAlgorithm
Algorithm
IHTISHAM UL HAQ
 
Introduction to Software Engineering & Information Technology
Introduction to Software Engineering & Information TechnologyIntroduction to Software Engineering & Information Technology
Introduction to Software Engineering & Information Technology
Gaditek
 
Yacc
YaccYacc
Yacc
BBDITM LUCKNOW
 
Compilers
CompilersCompilers
Compilers
Bense Tony
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
Sachin Goyani
 
Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1
REHAN IJAZ
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
Bilal Maqbool ツ
 
Lexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignLexical Analysis - Compiler Design
Lexical Analysis - Compiler Design
Akhil Kaushik
 
Lecture 1 - Lexical Analysis.ppt
Lecture 1 - Lexical Analysis.pptLecture 1 - Lexical Analysis.ppt
Lecture 1 - Lexical Analysis.ppt
NderituGichuki1
 
High level and Low level Language
High level and Low level Language High level and Low level Language
High level and Low level Language
adnan usmani
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
Akshaya Arunan
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
Paras Patel
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languages
NaqashAhmad14
 
Chapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to ProgrammingChapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to Programming
mshellman
 
Language processor
Language processorLanguage processor
Language processor
Abha Damani
 
Algorithm Design & Implementation
Algorithm Design & ImplementationAlgorithm Design & Implementation
Algorithm Design & Implementation
Gaditek
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
Rabin BK
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
Dhaval Kaneria
 
Introduction to Software Engineering & Information Technology
Introduction to Software Engineering & Information TechnologyIntroduction to Software Engineering & Information Technology
Introduction to Software Engineering & Information Technology
Gaditek
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
Sachin Goyani
 
Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1
REHAN IJAZ
 
Lexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignLexical Analysis - Compiler Design
Lexical Analysis - Compiler Design
Akhil Kaushik
 
Lecture 1 - Lexical Analysis.ppt
Lecture 1 - Lexical Analysis.pptLecture 1 - Lexical Analysis.ppt
Lecture 1 - Lexical Analysis.ppt
NderituGichuki1
 
High level and Low level Language
High level and Low level Language High level and Low level Language
High level and Low level Language
adnan usmani
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
Paras Patel
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languages
NaqashAhmad14
 
Chapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to ProgrammingChapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to Programming
mshellman
 
Language processor
Language processorLanguage processor
Language processor
Abha Damani
 

Viewers also liked (20)

Number+system (1)
Number+system (1)Number+system (1)
Number+system (1)
Bilal Maqbool ツ
 
Dld lecture module 06
Dld lecture module 06Dld lecture module 06
Dld lecture module 06
Bilal Maqbool ツ
 
English 01 application
English 01 applicationEnglish 01 application
English 01 application
Bilal Maqbool ツ
 
Dld lecture module 02
Dld lecture module 02Dld lecture module 02
Dld lecture module 02
Bilal Maqbool ツ
 
Chapter10
Chapter10Chapter10
Chapter10
Bilal Maqbool ツ
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligence
Bilal Maqbool ツ
 
Uncdtalk
UncdtalkUncdtalk
Uncdtalk
Bilal Maqbool ツ
 
Dld lecture module 05
Dld lecture module 05Dld lecture module 05
Dld lecture module 05
Bilal Maqbool ツ
 
Complement
ComplementComplement
Complement
Bilal Maqbool ツ
 
Dld lecture module 03
Dld lecture module 03Dld lecture module 03
Dld lecture module 03
Bilal Maqbool ツ
 
Dld lecture module 01
Dld lecture module 01Dld lecture module 01
Dld lecture module 01
Bilal Maqbool ツ
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
Bilal Maqbool ツ
 
Good
GoodGood
Good
Bilal Maqbool ツ
 
Dld lecture module 04 01
Dld lecture module 04  01Dld lecture module 04  01
Dld lecture module 04 01
Bilal Maqbool ツ
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
Bilal Maqbool ツ
 
Internet
InternetInternet
Internet
Bilal Maqbool ツ
 
Okkkkk
OkkkkkOkkkkk
Okkkkk
Bilal Maqbool ツ
 
An introduction to software
An introduction to softwareAn introduction to software
An introduction to software
Bilal Maqbool ツ
 
Notes of programming
Notes of programmingNotes of programming
Notes of programming
Bilal Maqbool ツ
 
Boolean+logic
Boolean+logicBoolean+logic
Boolean+logic
Bilal Maqbool ツ
 
Ad

Similar to Algorithm defination, design & Implementation (20)

algorithms and flow chart overview.pdf
algorithms and flow chart overview.pdfalgorithms and flow chart overview.pdf
algorithms and flow chart overview.pdf
AmanPratik11
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
dipti reya
 
Problem-solving and design 1.pptx
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptx
TadiwaMawere
 
AlgorithmAndFlowChart.pdf
AlgorithmAndFlowChart.pdfAlgorithmAndFlowChart.pdf
AlgorithmAndFlowChart.pdf
SusieMaestre1
 
programming concept
programming conceptprogramming concept
programming concept
Nehabhy
 
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffdPROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
dinesh620610
 
Basic Slides on Algorithms and Flowcharts
Basic Slides on Algorithms and FlowchartsBasic Slides on Algorithms and Flowcharts
Basic Slides on Algorithms and Flowcharts
moazwinner
 
Lecture1-Algorithms-and-Flowcharts-ppt.ppt
Lecture1-Algorithms-and-Flowcharts-ppt.pptLecture1-Algorithms-and-Flowcharts-ppt.ppt
Lecture1-Algorithms-and-Flowcharts-ppt.ppt
ReshuReshma8
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
rajkumar1631010038
 
Lect1-Algorithms-and-Flowchart PPT presentation
Lect1-Algorithms-and-Flowchart PPT presentationLect1-Algorithms-and-Flowchart PPT presentation
Lect1-Algorithms-and-Flowchart PPT presentation
gstagra
 
Lecture1-Algorithms-and-Flowchart-ppt.ppt
Lecture1-Algorithms-and-Flowchart-ppt.pptLecture1-Algorithms-and-Flowchart-ppt.ppt
Lecture1-Algorithms-and-Flowchart-ppt.ppt
samreen82
 
Algrithms and frowcharts.pptx
Algrithms and frowcharts.pptxAlgrithms and frowcharts.pptx
Algrithms and frowcharts.pptx
Gurneetsingh83
 
Lect1-Detailed description aboutAlgorithms-and-Flowchart.ppt
Lect1-Detailed description aboutAlgorithms-and-Flowchart.pptLect1-Detailed description aboutAlgorithms-and-Flowchart.ppt
Lect1-Detailed description aboutAlgorithms-and-Flowchart.ppt
gstagra
 
Pseudo code.pptx
Pseudo code.pptxPseudo code.pptx
Pseudo code.pptx
Chaya64047
 
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
 
Lec-ProblemSolving.pptx
Lec-ProblemSolving.pptxLec-ProblemSolving.pptx
Lec-ProblemSolving.pptx
miansaad18
 
MODULE1-INTRODUCTION.pptx-COMPUTER PROGRAMING
MODULE1-INTRODUCTION.pptx-COMPUTER PROGRAMINGMODULE1-INTRODUCTION.pptx-COMPUTER PROGRAMING
MODULE1-INTRODUCTION.pptx-COMPUTER PROGRAMING
MarcMiguel2
 
Algorithms and Flowchart usages in C laguage
Algorithms and Flowchart usages in C laguageAlgorithms and Flowchart usages in C laguage
Algorithms and Flowchart usages in C laguage
BalaKrishnan466
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
praveena p
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem sloving
Mani Kandan
 
algorithms and flow chart overview.pdf
algorithms and flow chart overview.pdfalgorithms and flow chart overview.pdf
algorithms and flow chart overview.pdf
AmanPratik11
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
dipti reya
 
Problem-solving and design 1.pptx
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptx
TadiwaMawere
 
AlgorithmAndFlowChart.pdf
AlgorithmAndFlowChart.pdfAlgorithmAndFlowChart.pdf
AlgorithmAndFlowChart.pdf
SusieMaestre1
 
programming concept
programming conceptprogramming concept
programming concept
Nehabhy
 
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffdPROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
dinesh620610
 
Basic Slides on Algorithms and Flowcharts
Basic Slides on Algorithms and FlowchartsBasic Slides on Algorithms and Flowcharts
Basic Slides on Algorithms and Flowcharts
moazwinner
 
Lecture1-Algorithms-and-Flowcharts-ppt.ppt
Lecture1-Algorithms-and-Flowcharts-ppt.pptLecture1-Algorithms-and-Flowcharts-ppt.ppt
Lecture1-Algorithms-and-Flowcharts-ppt.ppt
ReshuReshma8
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
rajkumar1631010038
 
Lect1-Algorithms-and-Flowchart PPT presentation
Lect1-Algorithms-and-Flowchart PPT presentationLect1-Algorithms-and-Flowchart PPT presentation
Lect1-Algorithms-and-Flowchart PPT presentation
gstagra
 
Lecture1-Algorithms-and-Flowchart-ppt.ppt
Lecture1-Algorithms-and-Flowchart-ppt.pptLecture1-Algorithms-and-Flowchart-ppt.ppt
Lecture1-Algorithms-and-Flowchart-ppt.ppt
samreen82
 
Algrithms and frowcharts.pptx
Algrithms and frowcharts.pptxAlgrithms and frowcharts.pptx
Algrithms and frowcharts.pptx
Gurneetsingh83
 
Lect1-Detailed description aboutAlgorithms-and-Flowchart.ppt
Lect1-Detailed description aboutAlgorithms-and-Flowchart.pptLect1-Detailed description aboutAlgorithms-and-Flowchart.ppt
Lect1-Detailed description aboutAlgorithms-and-Flowchart.ppt
gstagra
 
Pseudo code.pptx
Pseudo code.pptxPseudo code.pptx
Pseudo code.pptx
Chaya64047
 
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
 
Lec-ProblemSolving.pptx
Lec-ProblemSolving.pptxLec-ProblemSolving.pptx
Lec-ProblemSolving.pptx
miansaad18
 
MODULE1-INTRODUCTION.pptx-COMPUTER PROGRAMING
MODULE1-INTRODUCTION.pptx-COMPUTER PROGRAMINGMODULE1-INTRODUCTION.pptx-COMPUTER PROGRAMING
MODULE1-INTRODUCTION.pptx-COMPUTER PROGRAMING
MarcMiguel2
 
Algorithms and Flowchart usages in C laguage
Algorithms and Flowchart usages in C laguageAlgorithms and Flowchart usages in C laguage
Algorithms and Flowchart usages in C laguage
BalaKrishnan466
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
praveena p
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem sloving
Mani Kandan
 
Ad

More from Bilal Maqbool ツ (18)

Lecture 3 report writtng
Lecture 3 report writtngLecture 3 report writtng
Lecture 3 report writtng
Bilal Maqbool ツ
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
Bilal Maqbool ツ
 
Lecture 1 report writing
Lecture 1 report writingLecture 1 report writing
Lecture 1 report writing
Bilal Maqbool ツ
 
Bill gates
Bill gatesBill gates
Bill gates
Bilal Maqbool ツ
 
Programming assignment 02 (bilal maqbool 10) 2011
Programming assignment 02    (bilal maqbool 10) 2011Programming assignment 02    (bilal maqbool 10) 2011
Programming assignment 02 (bilal maqbool 10) 2011
Bilal Maqbool ツ
 
Programming assignment 30 12-11
Programming assignment 30 12-11Programming assignment 30 12-11
Programming assignment 30 12-11
Bilal Maqbool ツ
 
Internet presentation
Internet presentationInternet presentation
Internet presentation
Bilal Maqbool ツ
 
Presentation internet programming report
Presentation internet programming reportPresentation internet programming report
Presentation internet programming report
Bilal Maqbool ツ
 
Magnetic storage devices
Magnetic storage devicesMagnetic storage devices
Magnetic storage devices
Bilal Maqbool ツ
 
How internet technology be used to spread scientific awareness among pakistan...
How internet technology be used to spread scientific awareness among pakistan...How internet technology be used to spread scientific awareness among pakistan...
How internet technology be used to spread scientific awareness among pakistan...
Bilal Maqbool ツ
 
Math assignment Program
Math assignment ProgramMath assignment Program
Math assignment Program
Bilal Maqbool ツ
 
Final of sentences PPT
Final of sentences PPTFinal of sentences PPT
Final of sentences PPT
Bilal Maqbool ツ
 
Advantages and disadvantages of LCD
Advantages and disadvantages of LCDAdvantages and disadvantages of LCD
Advantages and disadvantages of LCD
Bilal Maqbool ツ
 
A history of windows
A history of windowsA history of windows
A history of windows
Bilal Maqbool ツ
 
Lcd
LcdLcd
Lcd
Bilal Maqbool ツ
 
Bluetooth 27 01-12 PPT
Bluetooth 27 01-12 PPTBluetooth 27 01-12 PPT
Bluetooth 27 01-12 PPT
Bilal Maqbool ツ
 
Bluetooth PPT Report
Bluetooth PPT ReportBluetooth PPT Report
Bluetooth PPT Report
Bilal Maqbool ツ
 
Computing assignment 02 ms access (bilal maqbool 10) se-i
Computing assignment 02   ms access (bilal maqbool 10)          se-iComputing assignment 02   ms access (bilal maqbool 10)          se-i
Computing assignment 02 ms access (bilal maqbool 10) se-i
Bilal Maqbool ツ
 
Programming assignment 02 (bilal maqbool 10) 2011
Programming assignment 02    (bilal maqbool 10) 2011Programming assignment 02    (bilal maqbool 10) 2011
Programming assignment 02 (bilal maqbool 10) 2011
Bilal Maqbool ツ
 
Programming assignment 30 12-11
Programming assignment 30 12-11Programming assignment 30 12-11
Programming assignment 30 12-11
Bilal Maqbool ツ
 
Presentation internet programming report
Presentation internet programming reportPresentation internet programming report
Presentation internet programming report
Bilal Maqbool ツ
 
How internet technology be used to spread scientific awareness among pakistan...
How internet technology be used to spread scientific awareness among pakistan...How internet technology be used to spread scientific awareness among pakistan...
How internet technology be used to spread scientific awareness among pakistan...
Bilal Maqbool ツ
 
Advantages and disadvantages of LCD
Advantages and disadvantages of LCDAdvantages and disadvantages of LCD
Advantages and disadvantages of LCD
Bilal Maqbool ツ
 
Computing assignment 02 ms access (bilal maqbool 10) se-i
Computing assignment 02   ms access (bilal maqbool 10)          se-iComputing assignment 02   ms access (bilal maqbool 10)          se-i
Computing assignment 02 ms access (bilal maqbool 10) se-i
Bilal Maqbool ツ
 

Recently uploaded (20)

2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx
mansk2
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)
Mohamed Rizk Khodair
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
How to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 PurchaseHow to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 Purchase
Celine George
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
*"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"**"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"*
Arshad Shaikh
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
puzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tensepuzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tense
OlgaLeonorTorresSnch
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx
mansk2
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)
Mohamed Rizk Khodair
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
How to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 PurchaseHow to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 Purchase
Celine George
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
*"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"**"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"*
Arshad Shaikh
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
puzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tensepuzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tense
OlgaLeonorTorresSnch
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 

Algorithm defination, design & Implementation

  • 1. WHAT IS AN ALGORITHM? It is a set of instructions of how to carry out a process. An algorithm lists the steps that must be followed to complete the process and to reach the solution Examples: • A knitting pattern • A set of instructions telling you how to put a kit together (eg. an kitchen unit) • A recipe in a cook book • An algorithm can be represented diagrammatically in the form of a flow chart. Algorithm constructions: There are three different constructions of algorithms.
  • 2. Properties of Algorithms: • An algorithm is an exact specification of how to solve a computational problem • An algorithm must specify every step completely, so a computer can implement it without any further “understanding” • An algorithm must work for all possible inputs of the problem. • Algorithms must be:  Correct: For each input produce an appropriate output  Efficient: run as quickly as possible, and use as little memory as possible – more about this later • There can be many different algorithms for each computational problem. Algorithms Phases: A typical programming task can be divided into two phases: 1. Problem solving phase (Designing) • produce an ordered sequence of steps that describe solution of problem • this sequence of steps is called an algorithm 2. Implementation phase • implement the program in some programming language Problem solving phase (Designing) : 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.
  • 3. • 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” The Flowchart: • (Dictionary) A schematic representation of a sequence of operations, as in a manufacturing process or computer program. • (Technical) A graphical representation of the sequence of operations in an information system or program. Information system flowcharts show how data flows from source documents through the computer to final distribution to users. Program flowcharts show the sequence of instructions in a single program or subroutine. Different symbols are used to draw each type of flowchart. • shows logic of an algorithm • emphasizes individual steps and their interconnections • e.g. control flow from one action to the next
  • 4. Flowchart Symbols: • A flowchart consists of a sequence of instructions linked together by arrows to show the order in which the instructions must be carried out. • It provides detailed steps. • Each instruction is put into a box. The boxes are different shapes depending upon what the instruction is. Oval Parallelogram Rectangle Diamond Hybrid Name Symbol Use in Flowchart Denotes the beginning or end of the program Denotes an input operation Denotes an output operation Denotes a decision (or branch) to be made. The program should continue along one of two routes. (e.g. IF/THEN/ELSE) Denotes a process to be carried out e.g. addition, subtraction, division etc. Flow line Denotes the direction of logic flow in the program
  • 5. Example 1: MAKING A CUP OF TEA! Pseudocode: 1. Take tea bag out of cup 2. Boil the water 3. Put tea bag in cup 4. Add milk? 5. Pour boiling water in cup 6. Fill kettle 7. Stir 8. Ready 9. Add sugar ? 10. Fetch cup Algorithm: 1. Fill kettle 2. Boil the water 3. Fetch cup 4. Put tea bag in cup 5. Pour boiling water in cup 6. Take tea bag out of cup 7. Add sugar ? 8. Stir 9. Add milk? 10. Stir 11. Ready
  • 6. Example 2: Grade students to identify pass & fail. Algorithm: Step 1: Input M1,M2,M3,M4 Step 2: GRADE  (M1+M2+M3+M4)/4 Step 3: if (GRADE <50) then Print “FAIL” else Print “PASS” endif Example 3 Write an algorithm and draw a flowchart that will read the two sides of a rectangle and calculate its area. Pseudocode 1. Input the width (W) and Length (L) of a rectangle 2. Calculate the area (A) by multiplying L with W 3. Print A Algorithm Step 1: Input W,L Step 2: A  L x W Step 3: Print A
  • 7. Pseudocode for three constructs: Flowcharts for three constructs
  翻译: