SlideShare a Scribd company logo
5
How can I write an algorithm ?
• The development of an algorithm (a plan) is a key step in solving a problem. Once we have
an algorithm, we can translate it into a computer program in some programming
language. Our algorithm development process consists of five major steps.
• Step 1: Obtain a description of the problem.
• Step 2: Analyze the problem.
• Step 3: Develop a high-level algorithm.
• Step 4: Refine the algorithm by adding more detail.
• Step 5: Review the algorithm.
Most read
6
A scope in details
1- Obtain a description of the problem.
This step is much more difficult than it appears. In the following discussion, the
word client refers to someone who wants to find a solution to a problem, and the
word developer refers to someone who finds a way to solve the problem.The developer must
create an algorithm that will solve the client's problem.
2- Analyze the problem.
The purpose of this step is to determine both the starting and ending points for solving the
problem
When determining the starting point, we should start by seeking answers to the following
questions:
-What data are available?
-Where is that data?
-What formulas pertain to the problem?
-What rules exist for working with the data?
-What relationships exist among the data values?
Most read
7
When determining the ending point, we need to describe the characteristics of a solution. In other words, how will we know when
we're done? Asking the following questions often helps to determine the ending point.
-What new facts will we have?
- what items will have changed?
-What changes will have been made to those items?
-What things will no longer exist?
3- Develop a high-level algorithm.
An algorithm is a plan for solving a problem, but plans come in several levels of detail. It's usually better to start with a high-level
algorithm that includes the major part of a solution, but leaves the details until later.
4- Refine the algorithm by adding more detail.
A high-level algorithm shows the major steps that need to be followed to solve a problem. Now we need to add details to these steps,
but how much detail should we add? Unfortunately, the answer to this question depends on the situation.
5- Review the algorithm.
The final step is to review the algorithm
Most read
P.S:
It is always said any important presentation should start with black background. I don’t know why but we
do as it is said
Presented By: Ahmed Nobi ;
Ahmed nobi
- Android developer with one year experience
- Android Developer at Cleodev software House.
- programming instructor with three year experience in Luxor and Aswan.
- working on online course (programming school)
- former chair IEEE Aswan SB
- Ex Vice Student representative IEEE Egypt Section
contact me:
LinkedIn: www.linkedin.com/in/ahmed-nobi
Facebook: www.facebook.com/Ahmed.Nobi.Eltwins
mail: ahmed.nobi95@gmail.com
Co –instructor: Abdelrahman Ashraf
knowledge
Visual basic , c++ , fortran , html , Photoshop, Adobe premier
Skills
Problem solving , video editor .
contact me:
Facebook: www.facebook.com/abdul.rhman.3720
Brief about me
You ask now how to start to code ?!
Before coding, we should start with algorithms.
What is the algorithms?!
Algorithms
• An algorithm is a set of instructions designed to perform
a specific task
The algorithm may include instructions for how to:
• start
• accept information
• display information
• transformations
• how to select decisions
• how to repeat sub-tasks
• when to terminate
How can I write an algorithm ?
• The development of an algorithm (a plan) is a key step in solving a problem. Once we have
an algorithm, we can translate it into a computer program in some programming
language. Our algorithm development process consists of five major steps.
• Step 1: Obtain a description of the problem.
• Step 2: Analyze the problem.
• Step 3: Develop a high-level algorithm.
• Step 4: Refine the algorithm by adding more detail.
• Step 5: Review the algorithm.
A scope in details
1- Obtain a description of the problem.
This step is much more difficult than it appears. In the following discussion, the
word client refers to someone who wants to find a solution to a problem, and the
word developer refers to someone who finds a way to solve the problem.The developer must
create an algorithm that will solve the client's problem.
2- Analyze the problem.
The purpose of this step is to determine both the starting and ending points for solving the
problem
When determining the starting point, we should start by seeking answers to the following
questions:
-What data are available?
-Where is that data?
-What formulas pertain to the problem?
-What rules exist for working with the data?
-What relationships exist among the data values?
When determining the ending point, we need to describe the characteristics of a solution. In other words, how will we know when
we're done? Asking the following questions often helps to determine the ending point.
-What new facts will we have?
- what items will have changed?
-What changes will have been made to those items?
-What things will no longer exist?
3- Develop a high-level algorithm.
An algorithm is a plan for solving a problem, but plans come in several levels of detail. It's usually better to start with a high-level
algorithm that includes the major part of a solution, but leaves the details until later.
4- Refine the algorithm by adding more detail.
A high-level algorithm shows the major steps that need to be followed to solve a problem. Now we need to add details to these steps,
but how much detail should we add? Unfortunately, the answer to this question depends on the situation.
5- Review the algorithm.
The final step is to review the algorithm
Let us do an activity
1. A Jeroo starts at (0, 0) facing East with no flowers in its pouch.There is a flower
at location (3, 0).Write a program that directs the Jeroo to pick the flower and
plant it at location (3, 2). After planting the flower, the Jeroo should hop one
space East and stop.There are no other nets, flowers, or Jeroos on the island.
 Analysis of the Problem (Step 2)
1.The flower is exactly three spaces ahead of the jeroo.
2.The flower is to be planted exactly two spaces South of its current location.
3.The Jeroo is to finish facing East one space East of the planted flower.
4.There are no nets to worry about.
 High-level Algorithm (Step 3)
Let's name the Jeroo Bobby. Bobby should do the following:
Get the flower
Put the flower
Hop East
 Detailed Algorithm (Step 4)
Let's name the Jeroo Bobby. Bobby should do the following:
Get the flower
Hop 3 times
Pick the flower
Put the flower
Turn right Hop 2 times Plant a flower
Hop East
Turn left Hop once
 Review the Algorithm (Step 5)
1.The high-level algorithm partitioned the problem into three rather easy sub problems. This seems like a good
technique.
2.This algorithm solves a very specific problem because the Jeroo and the flower are in very specific locations.
3.This algorithm is actually a solution to a slightly more general problem in which the Jeroo starts anywhere,
4.and the flower is 3 spaces directly ahead of the Jeroo.
2- Write an algorithm of summing two numbers. Get the values from user and display the result
- Analyze the problem (step 2)
1- Sum two numbers
2-there are no values to sum
3- giving summation’s value
High level algorithm (step 3)
1- define the variables
2- determine the expression
3- get numerical values to sum
4- get the final value
5- display the value
Detailed algorithm(step 4)
1- Define 3 variables
2 variables to sum and one for final
result: x, y and z respectively
2- determine the expression
z = x+ y
3- get numerical values to sum
Read from user 2 numerical values
4- Get the final value
z = x+ y
5- display theValue Display z
Review the algorithm (step 5)
compensate by value in
the expression
The per. solution is an ideal which we can use in the huge problems (program) so we can
simplify to that one:
Another solution:
1. define 3 variables x, y and z.
2. Determine the expression : z = x + y
3. Read x and y
4. Carrying out the expression
5. Display z
More Simple
• Define x, y,z
• Read | input x,y
• Z= x+y
• Display z
• end
start
accept information
display information
transformations
how to select decisions
how to repeat sub-tasks
when to terminate
What is next ?
So how to take Decision in Algorithms
Per example
Z= x+y
how to select decisions
So if you need to take decision, you must use “if “
So if you need to design an algorithm that tell you the given number is
positive or negative
After we analyze the problem
Solution :
Start
Define x ;
Read x
If (x>0)
Display “positive”
Else
Display “Negative”
end
how to select decisions
So if you need to take decision, you must use “if “
Design an algorithm that determine if the given number is odd or even
After we analyze the problem
Solution :
Start
Define x ;
Read x
If (x mod 2 == 0)
Display “even”
Else
Display “odd”
end
start
accept information
display information
transformations
how to select decisions
how to repeat sub-tasks
when to terminate
What is next ?
Per examples
Positive or negative
Even or odd
Per example
Z= x+y
How to repeat ? we use
loops
how to repeat sub-tasks
So if you need to repeat, we use loops
Design an algorithm that help you to write your little brother to do his
homework.The homework is to write the “the lion” lesson 10 times
After we analyze the problem
Solution :
Start
Define I,hw ;
Read hw
For( I = 1 : 10 )
Display hw
end
……It is not the end
1. write an algorithm of multiplying two number .
2. Write an algorithm to calculate the area of circle 𝐴 = 𝜋𝑟2
.
3. Write an algorithm of program that display “hello world ” when user types a positive
number, and display “bye world ” when user types a negative number.
4. Write an algorithm to print numbers between 0 to 10
5. Write an algorithm to calculate the factorial of any given number x!.
6. Write a program that display the number of digits of number . Ex 321 , consists of 3 digits
7. Write an algorithm that calculate the sum of digits. Example 123 = 6
Let ‘s practice more with new ideas
Where we
can type our
code ?
• We edit our code on editor. IDE (integrated
development environment /compiler
• CodeBlocks
Next session, we
‘re going to edit
our first code 

More Related Content

What's hot (20)

Compilers
CompilersCompilers
Compilers
Jayanga V. Liyanage
 
Explain in detail about a model for network security
Explain in detail about a model for network securityExplain in detail about a model for network security
Explain in detail about a model for network security
PVSaiGanesh
 
Network security cryptography ppt
Network security cryptography pptNetwork security cryptography ppt
Network security cryptography ppt
Thushara92
 
LISP: Data types in lisp
LISP: Data types in lispLISP: Data types in lisp
LISP: Data types in lisp
DataminingTools Inc
 
1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions
Sampath Kumar S
 
Macros...presentation
Macros...presentationMacros...presentation
Macros...presentation
fika sweety
 
HTTPS
HTTPSHTTPS
HTTPS
R.K. University
 
Algorithms and Flowcharts
Algorithms and FlowchartsAlgorithms and Flowcharts
Algorithms and Flowcharts
Deva Singh
 
Introduction to python history and platforms
Introduction to python history and platformsIntroduction to python history and platforms
Introduction to python history and platforms
Kirti Verma
 
Introduction to basic programming repetition
Introduction to basic programming repetitionIntroduction to basic programming repetition
Introduction to basic programming repetition
Jordan Delacruz
 
Django forms
Django formsDjango forms
Django forms
Rubin Damian
 
Chapter 5 Syntax Directed Translation
Chapter 5   Syntax Directed TranslationChapter 5   Syntax Directed Translation
Chapter 5 Syntax Directed Translation
Radhakrishnan Chinnusamy
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
Gayathri Gaayu
 
Gram-Schmidt process
Gram-Schmidt processGram-Schmidt process
Gram-Schmidt process
Burhanuddin Kapadia
 
Chapter 5The proessor status and the FLAGS registers
Chapter 5The proessor status and the FLAGS registersChapter 5The proessor status and the FLAGS registers
Chapter 5The proessor status and the FLAGS registers
warda aziz
 
Arrays in python
Arrays in pythonArrays in python
Arrays in python
moazamali28
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to Cryptography
Md. Afif Al Mamun
 
Generating function
Generating functionGenerating function
Generating function
Kongunadu College of Engineering and Technology
 
Order and Degree of Ordinary Differential Equations
 Order and Degree of Ordinary Differential Equations  Order and Degree of Ordinary Differential Equations
Order and Degree of Ordinary Differential Equations
AMINULISLAM439
 
presentation on matrix
 presentation on matrix presentation on matrix
presentation on matrix
Nikhi Jain
 
Explain in detail about a model for network security
Explain in detail about a model for network securityExplain in detail about a model for network security
Explain in detail about a model for network security
PVSaiGanesh
 
Network security cryptography ppt
Network security cryptography pptNetwork security cryptography ppt
Network security cryptography ppt
Thushara92
 
1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions
Sampath Kumar S
 
Macros...presentation
Macros...presentationMacros...presentation
Macros...presentation
fika sweety
 
Algorithms and Flowcharts
Algorithms and FlowchartsAlgorithms and Flowcharts
Algorithms and Flowcharts
Deva Singh
 
Introduction to python history and platforms
Introduction to python history and platformsIntroduction to python history and platforms
Introduction to python history and platforms
Kirti Verma
 
Introduction to basic programming repetition
Introduction to basic programming repetitionIntroduction to basic programming repetition
Introduction to basic programming repetition
Jordan Delacruz
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
Gayathri Gaayu
 
Chapter 5The proessor status and the FLAGS registers
Chapter 5The proessor status and the FLAGS registersChapter 5The proessor status and the FLAGS registers
Chapter 5The proessor status and the FLAGS registers
warda aziz
 
Arrays in python
Arrays in pythonArrays in python
Arrays in python
moazamali28
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to Cryptography
Md. Afif Al Mamun
 
Order and Degree of Ordinary Differential Equations
 Order and Degree of Ordinary Differential Equations  Order and Degree of Ordinary Differential Equations
Order and Degree of Ordinary Differential Equations
AMINULISLAM439
 
presentation on matrix
 presentation on matrix presentation on matrix
presentation on matrix
Nikhi Jain
 

Similar to Algorithms and how to write an algorithms (20)

C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHESC LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
HarshJha34
 
Programming in C - Problem Solving using C
Programming in C - Problem Solving using CProgramming in C - Problem Solving using C
Programming in C - Problem Solving using C
PoovizhiP1
 
Logic Development and Algorithm.
Logic Development and Algorithm.Logic Development and Algorithm.
Logic Development and Algorithm.
NandiniSidana
 
Challenges-and-Consideration-in-Programming-Logic-and-Design...pptx
Challenges-and-Consideration-in-Programming-Logic-and-Design...pptxChallenges-and-Consideration-in-Programming-Logic-and-Design...pptx
Challenges-and-Consideration-in-Programming-Logic-and-Design...pptx
RusherGamer1
 
Algorithm for computational problematic sit
Algorithm for computational problematic sitAlgorithm for computational problematic sit
Algorithm for computational problematic sit
Saurabh846965
 
Problem solving methodology
Problem solving methodologyProblem solving methodology
Problem solving methodology
Prof. Dr. K. Adisesha
 
Algorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo codeAlgorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo code
hamza javed
 
Study Material for Problem Solving Techniques
Study Material for Problem Solving TechniquesStudy Material for Problem Solving Techniques
Study Material for Problem Solving Techniques
Bobby Murugesan
 
Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptx
ShaistaRiaz4
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffdPROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
dinesh620610
 
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
 
FDFDRERSFDSGAGAFGGFGFGFGFGAFDGFDGFGFFAGFGGDF
FDFDRERSFDSGAGAFGGFGFGFGFGAFDGFDGFGFFAGFGGDFFDFDRERSFDSGAGAFGGFGFGFGFGAFDGFDGFGFFAGFGGDF
FDFDRERSFDSGAGAFGGFGFGFGFGAFDGFDGFGFFAGFGGDF
AlthimeseAnderson
 
Design and Analysis of Algorithm ppt for unit one
Design and Analysis of Algorithm ppt for unit oneDesign and Analysis of Algorithm ppt for unit one
Design and Analysis of Algorithm ppt for unit one
ssuserb7c8b8
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniya
TutorialsDuniya.com
 
CC-112-Lec.1.ppsx
CC-112-Lec.1.ppsxCC-112-Lec.1.ppsx
CC-112-Lec.1.ppsx
Aamir Shahzad
 
AOA Week 01.ppt
AOA Week 01.pptAOA Week 01.ppt
AOA Week 01.ppt
INAM352782
 
PPS_Unit 1.pptx
PPS_Unit 1.pptxPPS_Unit 1.pptx
PPS_Unit 1.pptx
KundanBhatkar
 
Lecture 2 role of algorithms in computing
Lecture 2   role of algorithms in computingLecture 2   role of algorithms in computing
Lecture 2 role of algorithms in computing
jayavignesh86
 
Ds03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhaniDs03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhani
jyoti_lakhani
 
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHESC LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
HarshJha34
 
Programming in C - Problem Solving using C
Programming in C - Problem Solving using CProgramming in C - Problem Solving using C
Programming in C - Problem Solving using C
PoovizhiP1
 
Logic Development and Algorithm.
Logic Development and Algorithm.Logic Development and Algorithm.
Logic Development and Algorithm.
NandiniSidana
 
Challenges-and-Consideration-in-Programming-Logic-and-Design...pptx
Challenges-and-Consideration-in-Programming-Logic-and-Design...pptxChallenges-and-Consideration-in-Programming-Logic-and-Design...pptx
Challenges-and-Consideration-in-Programming-Logic-and-Design...pptx
RusherGamer1
 
Algorithm for computational problematic sit
Algorithm for computational problematic sitAlgorithm for computational problematic sit
Algorithm for computational problematic sit
Saurabh846965
 
Algorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo codeAlgorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo code
hamza javed
 
Study Material for Problem Solving Techniques
Study Material for Problem Solving TechniquesStudy Material for Problem Solving Techniques
Study Material for Problem Solving Techniques
Bobby Murugesan
 
Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptx
ShaistaRiaz4
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffdPROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
dinesh620610
 
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
 
FDFDRERSFDSGAGAFGGFGFGFGFGAFDGFDGFGFFAGFGGDF
FDFDRERSFDSGAGAFGGFGFGFGFGAFDGFDGFGFFAGFGGDFFDFDRERSFDSGAGAFGGFGFGFGFGAFDGFDGFGFFAGFGGDF
FDFDRERSFDSGAGAFGGFGFGFGFGAFDGFDGFGFFAGFGGDF
AlthimeseAnderson
 
Design and Analysis of Algorithm ppt for unit one
Design and Analysis of Algorithm ppt for unit oneDesign and Analysis of Algorithm ppt for unit one
Design and Analysis of Algorithm ppt for unit one
ssuserb7c8b8
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniya
TutorialsDuniya.com
 
AOA Week 01.ppt
AOA Week 01.pptAOA Week 01.ppt
AOA Week 01.ppt
INAM352782
 
Lecture 2 role of algorithms in computing
Lecture 2   role of algorithms in computingLecture 2   role of algorithms in computing
Lecture 2 role of algorithms in computing
jayavignesh86
 
Ds03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhaniDs03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhani
jyoti_lakhani
 
Ad

Recently uploaded (20)

Automating Map Production With FME and Python
Automating Map Production With FME and PythonAutomating Map Production With FME and Python
Automating Map Production With FME and Python
Safe Software
 
Scaling FME Flow on Demand with Kubernetes: A Case Study At Cadac Group SaaS ...
Scaling FME Flow on Demand with Kubernetes: A Case Study At Cadac Group SaaS ...Scaling FME Flow on Demand with Kubernetes: A Case Study At Cadac Group SaaS ...
Scaling FME Flow on Demand with Kubernetes: A Case Study At Cadac Group SaaS ...
Safe Software
 
How to Generate Financial Statements in QuickBooks Like a Pro (1).pdf
How to Generate Financial Statements in QuickBooks Like a Pro (1).pdfHow to Generate Financial Statements in QuickBooks Like a Pro (1).pdf
How to Generate Financial Statements in QuickBooks Like a Pro (1).pdf
QuickBooks Training
 
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdfThe Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
Varsha Nayak
 
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Prachi Desai
 
How to purchase, license and subscribe to Microsoft Azure_PDF.pdf
How to purchase, license and subscribe to Microsoft Azure_PDF.pdfHow to purchase, license and subscribe to Microsoft Azure_PDF.pdf
How to purchase, license and subscribe to Microsoft Azure_PDF.pdf
victordsane
 
Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4
Gaurav Sharma
 
Agile Software Engineering Methodologies
Agile Software Engineering MethodologiesAgile Software Engineering Methodologies
Agile Software Engineering Methodologies
Gaurav Sharma
 
Maintaining + Optimizing Database Health: Vendors, Orchestrations, Enrichment...
Maintaining + Optimizing Database Health: Vendors, Orchestrations, Enrichment...Maintaining + Optimizing Database Health: Vendors, Orchestrations, Enrichment...
Maintaining + Optimizing Database Health: Vendors, Orchestrations, Enrichment...
BradBedford3
 
Rebuilding Cadabra Studio: AI as Our Core Foundation
Rebuilding Cadabra Studio: AI as Our Core FoundationRebuilding Cadabra Studio: AI as Our Core Foundation
Rebuilding Cadabra Studio: AI as Our Core Foundation
Cadabra Studio
 
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Top 11 Fleet Management Software Providers in 2025 (2).pdfTop 11 Fleet Management Software Providers in 2025 (2).pdf
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Trackobit
 
Best Inbound Call Tracking Software for Small Businesses
Best Inbound Call Tracking Software for Small BusinessesBest Inbound Call Tracking Software for Small Businesses
Best Inbound Call Tracking Software for Small Businesses
TheTelephony
 
Leveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer IntentsLeveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer Intents
Keheliya Gallaba
 
How John started to like TDD (instead of hating it) (ViennaJUG, June'25)
How John started to like TDD (instead of hating it) (ViennaJUG, June'25)How John started to like TDD (instead of hating it) (ViennaJUG, June'25)
How John started to like TDD (instead of hating it) (ViennaJUG, June'25)
Nacho Cougil
 
Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3
Gaurav Sharma
 
Online Queue Management System for Public Service Offices [Focused on Municip...
Online Queue Management System for Public Service Offices [Focused on Municip...Online Queue Management System for Public Service Offices [Focused on Municip...
Online Queue Management System for Public Service Offices [Focused on Municip...
Rishab Acharya
 
COBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM CertificateCOBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM Certificate
VICTOR MAESTRE RAMIREZ
 
Generative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its ApplicationsGenerative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its Applications
SandeepKS52
 
Build enterprise-ready applications using skills you already have!
Build enterprise-ready applications using skills you already have!Build enterprise-ready applications using skills you already have!
Build enterprise-ready applications using skills you already have!
PhilMeredith3
 
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The SequelMarketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
BradBedford3
 
Automating Map Production With FME and Python
Automating Map Production With FME and PythonAutomating Map Production With FME and Python
Automating Map Production With FME and Python
Safe Software
 
Scaling FME Flow on Demand with Kubernetes: A Case Study At Cadac Group SaaS ...
Scaling FME Flow on Demand with Kubernetes: A Case Study At Cadac Group SaaS ...Scaling FME Flow on Demand with Kubernetes: A Case Study At Cadac Group SaaS ...
Scaling FME Flow on Demand with Kubernetes: A Case Study At Cadac Group SaaS ...
Safe Software
 
How to Generate Financial Statements in QuickBooks Like a Pro (1).pdf
How to Generate Financial Statements in QuickBooks Like a Pro (1).pdfHow to Generate Financial Statements in QuickBooks Like a Pro (1).pdf
How to Generate Financial Statements in QuickBooks Like a Pro (1).pdf
QuickBooks Training
 
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdfThe Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
Varsha Nayak
 
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Prachi Desai
 
How to purchase, license and subscribe to Microsoft Azure_PDF.pdf
How to purchase, license and subscribe to Microsoft Azure_PDF.pdfHow to purchase, license and subscribe to Microsoft Azure_PDF.pdf
How to purchase, license and subscribe to Microsoft Azure_PDF.pdf
victordsane
 
Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4
Gaurav Sharma
 
Agile Software Engineering Methodologies
Agile Software Engineering MethodologiesAgile Software Engineering Methodologies
Agile Software Engineering Methodologies
Gaurav Sharma
 
Maintaining + Optimizing Database Health: Vendors, Orchestrations, Enrichment...
Maintaining + Optimizing Database Health: Vendors, Orchestrations, Enrichment...Maintaining + Optimizing Database Health: Vendors, Orchestrations, Enrichment...
Maintaining + Optimizing Database Health: Vendors, Orchestrations, Enrichment...
BradBedford3
 
Rebuilding Cadabra Studio: AI as Our Core Foundation
Rebuilding Cadabra Studio: AI as Our Core FoundationRebuilding Cadabra Studio: AI as Our Core Foundation
Rebuilding Cadabra Studio: AI as Our Core Foundation
Cadabra Studio
 
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Top 11 Fleet Management Software Providers in 2025 (2).pdfTop 11 Fleet Management Software Providers in 2025 (2).pdf
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Trackobit
 
Best Inbound Call Tracking Software for Small Businesses
Best Inbound Call Tracking Software for Small BusinessesBest Inbound Call Tracking Software for Small Businesses
Best Inbound Call Tracking Software for Small Businesses
TheTelephony
 
Leveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer IntentsLeveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer Intents
Keheliya Gallaba
 
How John started to like TDD (instead of hating it) (ViennaJUG, June'25)
How John started to like TDD (instead of hating it) (ViennaJUG, June'25)How John started to like TDD (instead of hating it) (ViennaJUG, June'25)
How John started to like TDD (instead of hating it) (ViennaJUG, June'25)
Nacho Cougil
 
Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3
Gaurav Sharma
 
Online Queue Management System for Public Service Offices [Focused on Municip...
Online Queue Management System for Public Service Offices [Focused on Municip...Online Queue Management System for Public Service Offices [Focused on Municip...
Online Queue Management System for Public Service Offices [Focused on Municip...
Rishab Acharya
 
COBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM CertificateCOBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM Certificate
VICTOR MAESTRE RAMIREZ
 
Generative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its ApplicationsGenerative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its Applications
SandeepKS52
 
Build enterprise-ready applications using skills you already have!
Build enterprise-ready applications using skills you already have!Build enterprise-ready applications using skills you already have!
Build enterprise-ready applications using skills you already have!
PhilMeredith3
 
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The SequelMarketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
BradBedford3
 
Ad

Algorithms and how to write an algorithms

  • 1. P.S: It is always said any important presentation should start with black background. I don’t know why but we do as it is said Presented By: Ahmed Nobi ;
  • 2. Ahmed nobi - Android developer with one year experience - Android Developer at Cleodev software House. - programming instructor with three year experience in Luxor and Aswan. - working on online course (programming school) - former chair IEEE Aswan SB - Ex Vice Student representative IEEE Egypt Section contact me: LinkedIn: www.linkedin.com/in/ahmed-nobi Facebook: www.facebook.com/Ahmed.Nobi.Eltwins mail: [email protected] Co –instructor: Abdelrahman Ashraf knowledge Visual basic , c++ , fortran , html , Photoshop, Adobe premier Skills Problem solving , video editor . contact me: Facebook: www.facebook.com/abdul.rhman.3720 Brief about me
  • 3. You ask now how to start to code ?! Before coding, we should start with algorithms. What is the algorithms?!
  • 4. Algorithms • An algorithm is a set of instructions designed to perform a specific task The algorithm may include instructions for how to: • start • accept information • display information • transformations • how to select decisions • how to repeat sub-tasks • when to terminate
  • 5. How can I write an algorithm ? • The development of an algorithm (a plan) is a key step in solving a problem. Once we have an algorithm, we can translate it into a computer program in some programming language. Our algorithm development process consists of five major steps. • Step 1: Obtain a description of the problem. • Step 2: Analyze the problem. • Step 3: Develop a high-level algorithm. • Step 4: Refine the algorithm by adding more detail. • Step 5: Review the algorithm.
  • 6. A scope in details 1- Obtain a description of the problem. This step is much more difficult than it appears. In the following discussion, the word client refers to someone who wants to find a solution to a problem, and the word developer refers to someone who finds a way to solve the problem.The developer must create an algorithm that will solve the client's problem. 2- Analyze the problem. The purpose of this step is to determine both the starting and ending points for solving the problem When determining the starting point, we should start by seeking answers to the following questions: -What data are available? -Where is that data? -What formulas pertain to the problem? -What rules exist for working with the data? -What relationships exist among the data values?
  • 7. When determining the ending point, we need to describe the characteristics of a solution. In other words, how will we know when we're done? Asking the following questions often helps to determine the ending point. -What new facts will we have? - what items will have changed? -What changes will have been made to those items? -What things will no longer exist? 3- Develop a high-level algorithm. An algorithm is a plan for solving a problem, but plans come in several levels of detail. It's usually better to start with a high-level algorithm that includes the major part of a solution, but leaves the details until later. 4- Refine the algorithm by adding more detail. A high-level algorithm shows the major steps that need to be followed to solve a problem. Now we need to add details to these steps, but how much detail should we add? Unfortunately, the answer to this question depends on the situation. 5- Review the algorithm. The final step is to review the algorithm
  • 8. Let us do an activity 1. A Jeroo starts at (0, 0) facing East with no flowers in its pouch.There is a flower at location (3, 0).Write a program that directs the Jeroo to pick the flower and plant it at location (3, 2). After planting the flower, the Jeroo should hop one space East and stop.There are no other nets, flowers, or Jeroos on the island.
  • 9.  Analysis of the Problem (Step 2) 1.The flower is exactly three spaces ahead of the jeroo. 2.The flower is to be planted exactly two spaces South of its current location. 3.The Jeroo is to finish facing East one space East of the planted flower. 4.There are no nets to worry about.  High-level Algorithm (Step 3) Let's name the Jeroo Bobby. Bobby should do the following: Get the flower Put the flower Hop East  Detailed Algorithm (Step 4) Let's name the Jeroo Bobby. Bobby should do the following: Get the flower Hop 3 times Pick the flower Put the flower Turn right Hop 2 times Plant a flower Hop East Turn left Hop once  Review the Algorithm (Step 5) 1.The high-level algorithm partitioned the problem into three rather easy sub problems. This seems like a good technique. 2.This algorithm solves a very specific problem because the Jeroo and the flower are in very specific locations. 3.This algorithm is actually a solution to a slightly more general problem in which the Jeroo starts anywhere, 4.and the flower is 3 spaces directly ahead of the Jeroo.
  • 10. 2- Write an algorithm of summing two numbers. Get the values from user and display the result - Analyze the problem (step 2) 1- Sum two numbers 2-there are no values to sum 3- giving summation’s value High level algorithm (step 3) 1- define the variables 2- determine the expression 3- get numerical values to sum 4- get the final value 5- display the value Detailed algorithm(step 4) 1- Define 3 variables 2 variables to sum and one for final result: x, y and z respectively 2- determine the expression z = x+ y 3- get numerical values to sum Read from user 2 numerical values 4- Get the final value z = x+ y 5- display theValue Display z Review the algorithm (step 5) compensate by value in the expression
  • 11. The per. solution is an ideal which we can use in the huge problems (program) so we can simplify to that one: Another solution: 1. define 3 variables x, y and z. 2. Determine the expression : z = x + y 3. Read x and y 4. Carrying out the expression 5. Display z More Simple • Define x, y,z • Read | input x,y • Z= x+y • Display z • end
  • 12. start accept information display information transformations how to select decisions how to repeat sub-tasks when to terminate What is next ? So how to take Decision in Algorithms Per example Z= x+y
  • 13. how to select decisions So if you need to take decision, you must use “if “ So if you need to design an algorithm that tell you the given number is positive or negative After we analyze the problem Solution : Start Define x ; Read x If (x>0) Display “positive” Else Display “Negative” end
  • 14. how to select decisions So if you need to take decision, you must use “if “ Design an algorithm that determine if the given number is odd or even After we analyze the problem Solution : Start Define x ; Read x If (x mod 2 == 0) Display “even” Else Display “odd” end
  • 15. start accept information display information transformations how to select decisions how to repeat sub-tasks when to terminate What is next ? Per examples Positive or negative Even or odd Per example Z= x+y How to repeat ? we use loops
  • 16. how to repeat sub-tasks So if you need to repeat, we use loops Design an algorithm that help you to write your little brother to do his homework.The homework is to write the “the lion” lesson 10 times After we analyze the problem Solution : Start Define I,hw ; Read hw For( I = 1 : 10 ) Display hw end
  • 17. ……It is not the end
  • 18. 1. write an algorithm of multiplying two number . 2. Write an algorithm to calculate the area of circle 𝐴 = 𝜋𝑟2 . 3. Write an algorithm of program that display “hello world ” when user types a positive number, and display “bye world ” when user types a negative number. 4. Write an algorithm to print numbers between 0 to 10 5. Write an algorithm to calculate the factorial of any given number x!. 6. Write a program that display the number of digits of number . Ex 321 , consists of 3 digits 7. Write an algorithm that calculate the sum of digits. Example 123 = 6 Let ‘s practice more with new ideas
  • 19. Where we can type our code ? • We edit our code on editor. IDE (integrated development environment /compiler • CodeBlocks
  • 20. Next session, we ‘re going to edit our first code 