Title: The Origins of
1The Origins of Algorithm
2The Origins of the Term Algorithm
3Developing Algorithm Using Stepwise Refinement
- Read the problem statement carefully
- Rewrite it in your own words if it is not clear
- Highlight the nouns and look for data items
- Highlight the verbs to determine the work that
needs to be done - Write the initial algorithm that just describes
the inputs, outputs and work to be done
4Stepwise Refinement
- Now go back to each step in the initial algorithm
and refine it to describe how it will be
implemented - The Key steps are
- Rewrite the statement if not clear
- NounsgtData, VerbsgtAction
- Initial Algorithm(WHAT)
- Final Algorithm(HOW)
5Algorithm Development Exercise
- Problem 1
- A Sunoco gas station offers 5 cents per gallon
discount each Sunday. If a person fills up 20
gallons every week, how much money will that
person save in X weeks?
6Algorithm Development Exercise
- Problem 2
- Given the radius of a circle, develop an
algorithm that computes the area and circumference
7Algorithm Development Exercise
- Problem 3
- Write a cash register algorithm that will compute
7 percent sales tax at the price of an item and
then add the tax to the price to obtain the final
price
8Properties of Algorithms
- Simplicity
- Precision
- Various Levels of Abstraction
9Algorithms
- Algorithms specify the behavior
- Programs in specific languages just express the
algorithm in one particular form
10Information
- Information means knowledge about something
- Data is a specific representation of information
11Components of An Algorithm
- Data Structures
- Data Manipulation Instructions
- Conditional Expressions
- (if price greater than my_limit then dont buy)
- Control Structures
- (while (condition) do statement
- Modules
12Levels of Abstraction
- Details are HIDDEN if we use TOP DOWN approach to
describe algorithms - Example Counting names that begin with A in a
list of names
13Recap
- What is the advantage of hiding details at the
initial level of algorithm development? - What properties of an object must be known to us
before we can use it? - How can we make software reusable?
- How many types of statements can be part of an
algorithm?