Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 1: An Introduction to Computer Science Invitation to Computer Science, C++ Version, Third Edition.

Similar presentations


Presentation on theme: "Chapter 1: An Introduction to Computer Science Invitation to Computer Science, C++ Version, Third Edition."— Presentation transcript:

1 Chapter 1: An Introduction to Computer Science Invitation to Computer Science, C++ Version, Third Edition

2 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 2 Objectives In this chapter, you will learn about: The definition of algorithm The definition of computer science Overiew of the course

3 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 3 What 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.

4 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 4 Example 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

5 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 5 The 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 1. Boil two quarts of water 2. Add ½ lb of pasta in the water 3. Strain the water 4. Add the sauce

6 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 6 The 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. -

7 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 7 The 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.

8 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 8 The 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…

9 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 9 The 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.

10 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 10 The 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

11 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 11 Which 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.

12 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 12 Common 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

13 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 13 The 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

14 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 14 1. 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?

15 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 15 2. 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.

16 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 16 3. 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++.

17 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 17 4. 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

18 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 18 Overview 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 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 19 Figure 1.9 Organization of the Text into a Six-Layer Hierarchy

20 Invitation to Computer Science, C++ Version, Third Edition - Modified by A. Guercio 20 Summary 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

21 BE 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/CS10051- 600.html


Download ppt "Chapter 1: An Introduction to Computer Science Invitation to Computer Science, C++ Version, Third Edition."

Similar presentations


Ads by Google