SLIDE 1
1
Fundamentals: All About Algorithms
Computer Literacy Lecture 23
What is an Algorithm?
- Quite generally, an algorithm is a set of
instructions that lead to some desired result
- Must first decompose a problem, and
then express it’s method of solution as a series of well defined steps to be followed.
- So an algorithm is a recipe for achieving a
certain goal
Pancake Recipe
- 1. Mix 1 egg and 11/2 cups of milk
- 2. Add to 2 cups of sifted flour
- 3. Stir until smooth
- 4. Mix in 2 tablespoons of melted butter
- 5. Pour some of the mixture into a hot pan
and fry
- 6. Serve with maple syrup, sugar or jam
It’s All Relative
- Whether or not a list of instructions counts
as an ‘algorithm’ is relative to a set of background assumptions about what kind
- f device will be following the instructions,
what its basic capacities are, etc.
- Can fill in steps between steps as the level
- f analysis becomes more and more fine
grained
Where to begin
- For example, the Pancake recipe doesn’t
include an initial step:
- 0. place an adequately sized mixing bowl
- n a flat surface
And it doesn’t tell you how to sift the flour or melt the butter, etc.
- these steps between steps are simply
assumed
Effective Procedures
In the most rigorous context, algorithms are the recipes that a computer can follow
- In this sense they can be thought of as