Held Wednesday, February 2, 2000
Today, we move on to the study of algorithms. We begin by considering
the various ways that programmers tell computers to do things. We
then consider a sample ``real world'' algorithm: building a sandwich.
Question 7 for today's class: Unambiguously describe how to make a peanut butter and jelly sandwich.
Question 8 for tomorrow's class: Describe unambiguously how to find the lowest grade in a list of grades.
- Don't forget to send me notes on Risks
by Friday afternoon.
- Yes, I know the readings in Dewdney are hard. I don't expect you to
understand them completely (and we may not go over every part).
- For Friday, read chapter 21 of Dewdney (The Newton-Raphson method)
- How do we tell the computer to do things? Three models:
- Low level (circuitry)
- Medium level (assembly code)
- High level (algorithms)
- A sample algorithm: building a sandwich
- What is a computer?
- At heart, it is a fairly dumb device that can do some simple things.
- What simple things can it do?
- We use different layers of abstraction, and each layer of
abstraction provides a different set of capabilities.
- One abstraction that is particularly useful is to think of the
computer as having five parts:
- Memory/storage (which stores both data and programs)
- An arithmetic logic unit (ALU) that does math
- A control unit that tells the other parts to do things
- At the lowest level, a computer is just a mass of circuitry.
- Many of the circuits have an associated switch that turns them
on or off or controls where information goes.
- At one time, we programmed computers by rewiring them.
- We tend to think of computers at a slightly higher level. Our
basic machines are a lot like the SCRAM (Chapter 48).
- Since it's too difficult for most of us to work at the SCRAM level,
programmers soon designed higher-level assembly languages.
- The Random Access Machine of Chapter 17 provides one such assembly
- But these are also often too detailed, so we work in even higher
- Our main goal in any language is to express algorithms,
instructions for doing thigns.
- Since computers are just circuitry, they have no real underlying
- This means that either you or someone else has to describe how to
do something clearly and unambiguously.
- It turns out that unambiguous descriptions are hard.
- As an example, we'll consider how to make a peanut butter and
- Spend a few minutes reading over the