Professional Documents
Culture Documents
Algorithms
An Algorithm is a step-by-step solution to a
problem.
It is like a cooking recipe for mathematics.
An algorithm is a set of rules that precisely defines a
sequence of operations
Algorithm is the step-by-step sequence of
instructions that describe how the data is to be
processed to produce the desired output
Logic
a proper or reasonable way of thinking about or
understanding something
a particular way of thinking about something
the formal systematic study of the principles of valid
inference and correct reasoning
the science that studies the formal processes used
in thinking and reasoning
Art of reasoning
Algorithms as applied to
Real-Life Situations
Algorithm for posting a Status in Facebook
Algorithm for Searching in Google
Algorithm for Sending SMS using your
Cellphone
Algorithm for Saving a Microsoft Document
Algorithm for Frying Sunny Side-Up Egg
Pseudocode
An English-like representation of the same thing.
PSEUDO = FALSE
CODE = A program means to put in a
programming language
Pseudolanguage Instructions
Example Problem 1:
We want to be able to enter the ages of two
people and have the computer calculate their
average age and display the answer.
Answer:
1. DISPLAY a message asking the user to enter the first age
2. GET the first age and STORE to AGE1
3. DISPLAY a message asking the user to enter the second
age
4. GET the second age and STORE to AGE2
5. CALCULATE AVG_AGE by ADDING AGE1 and AGE2
DIVIDE BY 2
6. DISPLAY AVG_AGE on the screen
Example Problem 2:
Create a pseudo-code that will convert
Fahrenheit temperature to Celsius
temperature.
Board Work