Algorithms
Tom Kelliher, CS 102
Nov. 29, 2006
Written quiz Friday.
No reading, no online quiz.
JavaScript lab.
- Introduction.
- Lab.
Artificial Intelligence.
An algorithm is a set of simple steps for accomplishing something.
For example, a computation.
Here is an example for determining if any number in a list is negative.
I am going to give you a series of numbers, one at at time. When I am
finished, I will say ``End.'' If any of the numbers is negative, you
should say, ``Yes, halt.'' If I say ``End,'' you should reply, ``No,
halt.''
This algorithm will work for any finite list of numbers.
Working as a class, solve the following problems.
- Form the sum of a list of numbers.
- Find the smallest item in a list of numbers.
- Determine the average of a list of numbers.
- Determine if a list of numbers is sorted in ascending order. (Assume all
items are unique.)
- Determine if a list of numbers has size exactly five.
- Determine if a list of numbers contains a specified number (provided
first).
- Sort a list of numbers into ascending order. (Assume all items are
unique.)
- Determine the median of a list of numbers.
- Determine the most frequently occurring score (the mode) on an exam
worth 100 points.
Thomas P. Kelliher
2006-11-27
Tom Kelliher