Textbook: Chapters 1 and 2.
What's this all about?
To understand the
Dr. Bob Frederking (and the ghost of CBurch)
Email: ref@cs.cmu.edu
Giancarlo Dozzi
Raksha Kumar
Anthony Velázquez
GOVIES
``The textbook is excellent! It is very easy to understand and I used constantly as a reference while programming.''
``You could also assign pages to read in the textbook so that the students are somewhat prepared and not as clueless.''
(These quotes are from the PGSS '99 final course evaluations.)You asked for it...
For those with programming experience:
Enough preliminaries! What is computer science?
Computer science seeks to answer:
But computer science should be about computers!
Computing science would be a better name. (Or maybe ``Informatics''?)
But computers are essentially tools for problem-solving:
Let's look at the ``circles'' of CS.
What are the fastest ways to solve particular problems?
How can we build better problem-solving tools?
How can we build better programs?
How can we behave `intelligently' automatically?
How can we best represent procedure?
We're covering all that?
Table 1: Tentative schedule of topic coverage
Session Material 1 Prologue 2 Programming 3 : 4 : 5 : 6 : 7 : 8 Recursion 9 Playing Games 10 Internet 11 : 12 Cryptography 13 Computer Hardware 14 Models of Computation 15 Comparative Programming Languages 16 Human Language Translation
This is very tentative!
If you ever feel yourself getting lost:
Don't make me do all the work!
If computer science is
about solving problems...
What is a problem?
A problem is a set of questions with well-defined answers.
Examples of problems:
Non-examples:
For a set of questions, a problem's input identifies the question to be answered.
The output is the answer to the question.
Example:
Problem ADDITION:
Input: two numbers x and y.
Output: the sum x+y.
A problem instance is a particular question from the set: ``What is 6 + 9?''
You mean we're going to study arithmetic?
Our problems won't always be obviously mathematical.
Example:
Problem CHESS:
Input: a configuration of the board.
Output: a move for white guaranteeing a win.
Example input:
Q - - - - - - -
- - - - K - - R boldface = black
- - - P - - - - roman = white
- - - P - - - - P = pawn
- - - - P - P - R = rook
- - - - - P - - K = king
- - - - - - - - Q = queen
- R - K - - - -
An algorithm is a method for solving a problem that
Example: an algorithm for ADDITION
111
1999
+ 125
------
2124
Think of algorithms for PRIMALITY.
Problem PRIMALITY:
Input: a number n that is greater than 1.
Output: true if n is prime, false if not.
Here are two algorithms. Each is written in pseudocode, a recipe-like mixture of blank space, English, and math.
There is no one ``system'' to pseudocode. I use my way, you use yours! Just make it pretty!First algorithm:
Algorithm Prime-Test-Exhaustive(n):
for each i from 2 to n-1, do:
if i divides n, then:
output false.
stop.
end of if
end of loop
output true.
stop.
Second algorithm:
Algorithm Prime-Test-All(n):
for each integer i from 2 to sqrt(n), do:
if i divides n, then:
output false.
stop.
end of if
end of loop
output true.
stop.
Problem MISSING-CARD:
Input: 51 cards, each labeled uniquely between 1 and 52.
Output: the number missing from the deck.
One algorithm:
Algorithm Find-Missing-Card(deck):
while deck is not in increasing order, do:
Shuffle deck.
end of loop
Find skipped number in deck.
Say this number.