An unambiguous process (i.e., ordered set of steps) for solving
a problem using a finite amount of resources
Heuristic:
A problem solving process that is not guaranteed to
be perfect/exact
History
Algorithm:
The Oxford English Dictionary (OED) says it was first used
with this meaning in 1811 (but as early as 1658 with similar
meanings)
Some believe that the word is derived from the name of a
Persian mathematics teacher named Muhammad ibn-Musa
al-Khowarizm, one of the first people to develop
step-by-step procedures for doing computations
Heuristic:
The OED says it was first used
with this meaning in 1957 (but as early as 1770 with similar
meanings)
It may come from the Latin word meaning "ultimately" or the
Greek word meaning "find" (and hence is sometimes used
only for processes that learn/discover)
An Example
Taken from a Shampoo Bottle:
Wet your hair
Apply shampoo
Lather
Rinse
Repeat
Questions:
Is it a set of steps?
Is it an algorithm, a heuristic, or neither?
Where Do Algorithms Come From?
In Some Situations:
They are a recording/reporting of what is already known
In Other Situations:
They must be discovered/invented
Algorithm Development's Place in the Cognitive Domain
Bloom's (Updated) Taxonomy of the Cognitive Domain:
Creating
Evaluating
Analyzing
Applying
Understanding
Remembering
Algorithm Development:
Is not the regurgitation of memorized processes
Is about evaluating existing processes and creating
new ones
Science or Engineering?
Science:
Involves the use of the scientific method
(hypothesize, predict, and experiment)
Solve the problem recording the steps you use
as you perform them
Verify that the algorithm works
Describe what you did:
Solve the problem
Record the steps you used
Verify that the algorithm works
Developing New Algorithms
Look for related problems/algorithms (i.e., patterns)
More general problems/algorithms
More specific problems/algorithms
Analogous problems/algorithms
Look for "subproblems"
Partition the data
Divide the problem
Commonalities Across Algorithms
Decomposition:
Large algorithms are often broken down into a collection of
smaller sub-algorithms (using abstraction)
Input:
Information is often obtained from external "producers"
(e.g., users, sensors)
Memory/Recall:
Information often needs to be stored and recalled
Operations:
Information is often manipulated (e.g., added,
concatenated)
Commonalities Across Algorithms (cont.)
Conditions:
Operations are often performed under some circumstances
but not others
Iterations:
Operations are often performed repeatedly/iteratively
Output:
Information is often presented to external "consumers"
(e.g., users, devices)
Abstraction in Algorithm Development
Abstraction Defined:
"The act or process of separating in thought,
of considering a thing independently..." (OED)
Using Abstraction:
Focus on what is important
Ignore/hide unnecessary details
Leads to top-down development (treating some things
as "black boxes")
A "High Level" Algorithm for Eggs Benedict
Prepare Hollandaise sauce
Toast English muffin
Poach eggs until whites are soft
Grill Canadian bacon
Plate the completed dish
A "High Level" Algorithm for Hollandaise
Heat butter until bubbling
Combine all other ingredients in blender
Pour butter into running blender in a slow stream
A "Lower Level" Algorithm for Hollandaise
Put butter in pot
Turn on burner
Put pot on burner
While not bubbling, leave pot on burner
Remove pot from burner
If you like spicy sauce, put tabasco sauce in blender
Put all other ingredients in blender
Turn on blender
While you have butter, pour butter into blender in a slow stream
Turn off blender