Title: Chapter 1: An Introduction to Computer Science
1Chapter 1 An Introduction to Computer Science
- Invitation to Computer Science,
- C Version, Third Edition
2Objectives
- In this chapter, you will learn about
- The definition of algorithm
- The definition of computer science
- Overiew of the course
3What is an Algorithm?
- An algorithm is a
- well-ordered collection of
- unambiguous and
- effectively computable operations that, when
executed, - produces a result and
- halts in a finite amount of time.
4Example of Algorithm
- An algorithm is a list that looks like
- STEP 1 Do something
- STEP 2 Do something
- STEP 3 Do something
- . .
- . .
- . .
- STEP N Stop, you are finished
5The Formal Definition of an Algorithm
- Algorithm
- A well-ordered collection of unambiguous and
effectively computable operations that, when
executed, produces a result and halts in a finite
amount of time - Example Make Pasta
- Boil two quarts of water
- Add ½ lb of pasta in the water
- Strain the water
- Add the sauce
6The Formal Definition of an Algorithm (continued)
- Unambiguous operation
- An operation that can be understood and carried
out directly by the computing agent without
needing to be further simplified or explained - Ex.
- Boil some water (ambiguous)
- Boil 2 quarts of water (unambiguous)
- An operation that is unambiguous is called a
primitive operation (or just a primitive) - Q. - What are the primitives of a computer?
- A. -
7The Formal Definition of an Algorithm (continued)
- Effectively computable
- Computational process exists that allows
computing agent to complete that operation
successfully - Note that a given collection of operations may be
an algorithm with respect to one computing agent,
but not with respect to another computing agent!! - Example of not effectively computable operations
- Write all the real numbers between 0 and 1.
8The Formal Definition of an Algorithm (continued)
- The result of the algorithm must be produced
after the execution of a finite number of
operations - i.e. Can the user of the algorithm observe a
result produced by the algorithm? - A result can be a sign, a sound, an alarm, a
number, a message of error, ect
9The Formal Definition of an Algorithm (continued)
- It halts in a finite amount of time.
- Infinite loop
- The algorithm has no provisions to terminate
- A common error in the designing of algorithms
- Do not confuse, "not finite" with "very, very
large". - Q. - Is this loop finite or very, very large?
- Step 1. Write the number 1 on the board.
- Step 2. Add 1 to the number you just wrote and
write the result on the board - Step 3. Repeat Step 2.
- Step 4. Stop.
10The Importance of Algorithmic Problem Solving
- Algorithmic solutions can be
- Encoded into some appropriate language
- Given to a computing agent to execute
- The computing agent
- Would mechanically follow these instructions and
successfully complete the task specified - Would not have to understand
- Creative processes that went into discovery of
solution - Principles and concepts that underlie the problem
11Which of those is an algorithm?
- Write all the possible numbers on a paper.
- Fill 1 cup of sugar. Mix it to 3 cups of milk.
- Think of a number. Add 20 to it.
- Either wet your hair or lather your hair. Then
rinse your hair. - If your hair are dirty, wet your hair lather
your hair rinse your hair else go back to study.
12Common misconceptions about Computer Science
- Misconception 1
- Computer science is the study of computers
- Misconception 2
- Computer science is the study of how to write
computer programs - Misconception 3
- Computer science is the study of the uses and
applications of computers and software
13The Definition of Computer Science
- Computer science is the study of algorithms
including - 1. Their formal and mathematical properties
- 2. Their hardware realizations
- 3. Their linguistic realizations
- 4. Their applications
141. Their formal and mathematical properties
- It is not enough to design an algorithm to solve
a problem. - We must worry about some additional properties of
an algorithm - How efficient is it?
- What kinds of resources must be used to execute
it? - How does it compare to other algorithms that
solve the same problem?
152. Their hardware realizations
- Computing entities are required to execute
algorithms - Computing entities are not necessarily machines!
- However our interest will lie with algorithms
that execute on computing entities called
"computers". - How are computer constructed?
- The emphasis of the course will be on the logical
construction of a computer, not the physical
construction.
163. Their linguistic realizations
- Which language do we use to code the algorithms?
- We will start with one linguistic realization,
called pseudocode and later will look at possible
different realizations in various programming
languages. - In particular we will do some introductory
programming in C.
174. Their applications
- What are some of the many important and popular
applications of computers in current use
including - numerical problem solving
- information retrieval
- graphics
- networking
- artificial intelligence
- telecommunications
- modeling and simulation
18Overview of the course
- 1. The algorithmic foundations of computer
science. (Ch 1-3) - 2. The hardware world. (Ch 4-5)
- 3. The virtual machine. (Ch 6-7)
- 4. The software world. (Ch 8-11)
- 5. Applications. (Ch 12-14)
- 6. Social issues. (Ch 15)
- Note these correspond to the levels of the
pyramid on the cover of your text. - Each level addresses one aspect of the definition
of computer science - Computer science/Algorithms
19- Figure 1.9
- Organization of the Text into a Six-Layer
Hierarchy
20Summary
- Computer science is the study of algorithms
- An algorithm is a well-ordered collection of
unambiguous and effectively computable operations
that, when executed, produces a result and halts
in a finite amount of time - If we can specify an algorithm to solve a
problem, then we can automate its solution - Computers developed from mechanical calculating
devices to modern electronic marvels of
miniaturization
21BE SURE TO CHECK THE CLASS WEBSITE DAILY FOR YOUR
- Reading assignments
- Homework assignments
- Other materials related to this course
http//www.personal.edu/aguercioa/Spring06/CS1005
1-600.html