1 / 35

Chapter 1 An Introduction to Computer Science

Chapter 1 An Introduction to Computer Science. 1. Objectives. After studying this chapter, students will be able to: Understand the definition of computer science Write everyday algorithms and evaluate them to determine if they are ambiguous or not effectively computable.

talia
Télécharger la présentation

Chapter 1 An Introduction to Computer Science

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 1An Introduction to Computer Science 1

  2. Objectives After studying this chapter, students will be able to: • Understand the definition of computer science • Write everyday algorithms and evaluate them to determine if they are ambiguous or not effectively computable Invitation to Computer Science, 6th Edition

  3. Objectives (continued) After studying this chapter, students will be able to: • Understand the roots of modern computer science in mathematics thousands of years old and in mechanical machines hundreds of years old • Summarize the key points in the historical development of modern electronic computers • Map the organization of the text onto the definition of computer science Invitation to Computer Science, 6th Edition

  4. What is Computer Science? • Computer science is the study of computers • Computer science is the study of how to write computer programs • Computer science is the study of the uses and applications of computers and software Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  5. Misconceptions COMMON MISCONCEPTIONS • Computer science is the study of computers • Incomplete – theoretical work began ( 1920-1940) before computers • CS became an independent field of study late 1950’s, early 1960’s • Theoretical CS – relies on formal models rather than “real” machines • CS “is no more about computers than astronomy is about telescopes”, etc. ( see quote on p.3) Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  6. Misconceptions COMMON MISCONCEPTIONS • Computer science is the study of how to write computer programs • Programming is important, but it is just a tool for studying new ideas, representing information or testing the solution to a problem. • A Program is a means to an end, not the end itself. • Eg. Searching a list such as the NYC phone Directory Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  7. Misconceptions COMMON MISCONCEPTIONS • Computer science is the study of the uses and applications of computers and software • Eg. COM 140-141 – word processors, databases, spreadsheets, etc. • Many people USE software, but the Computer Scientist is responsible for specifying, designing, building and testing software packages and the systems on which they run. Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  8. Misconceptions • All of these are common misconceptions: • Computer science is: • The study of computers • The study of how to write computer programs • The study of the uses and applications of computers and software • All of these concepts (computers, programming languages, software applications, and uses ) are incomplete and do not capture the richness and diversity of this new and exciting field. Invitation to Computer Science, 6th Edition

  9. The Definition of Computer Science • Computer science is the study of algorithms, including: • Their formal and mathematical properties • Their hardware realizations • Their linguistic realizations • Their applications • IMPORTANT!!!! Invitation to Computer Science, 6th Edition

  10. Computer Science is the study of Algorithms including: • their formal and mathematical properties • studying the behavior of algorithms to see that they are correct and efficient • their hardware realizations • designing and building computer systems to execute the algorithms Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  11. Computer Science is the study of Algorithms including: • their linguistic realizations • designing programming languages and translating the algorithms into these languages so that they can be executed by the hardware • their applications • identifying important problems and designing correct and efficient software packages to solve them. Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  12. Algorithm An algorithm is • a procedure for solving a mathematical problem in a finite number of steps that frequently involves the repetition of some operation; • a step-by–step method for accomplishing some task; • a finite series of steps for solving a problem. Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  13. 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 Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  14. Invitation to Computer Science, 6th Edition

  15. The Definition of Computer Science (continued) • Algorithm • Informally, “an ordered sequence of instructions that is guaranteed to solve a specific problem.” • Operations used to construct algorithms • Sequential operations • Conditional operations • Iterative operations Invitation to Computer Science, 6th Edition

  16. Operations • Sequential – simple well-defined task, usually declarative sentence. • Conditional- “ask a question and select the next operation on the basis of the answer to the question – usually an “if- then” or “if then else” • Iterative- “looping” instructions – repeat a set of instructions • ( See pp. 6 and 7) Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  17. Sequential Operations Sequential Operations Carry out a single well-defined task; when that task is finished, the algorithm moves on to the next operation • Examples: • Add 1 cup of butter to the mixture in the bowl • Subtract the amount of the check from the current account balance • Set the value of x to 1 Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  18. Conditional Operations Conditional operations: Ask a question and then select the next operation to be executed on the basis of the answer to that question Examples: • If the mixture is too dry, then add one-half cup of water to the bowl • If the amount of the check is less than or equal to the current account balance, then cash the check; otherwise, tell the person that the account is overdrawn • If x is not equal to 0, then set y equal to 1/x; otherwise, print an error message that says we cannot divide by 0 Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  19. Iterative Operations • Iterative Operations • Tell us to go back and repeat the execution of a previous block of instructions • Examples • Repeat the previous two operations until the mixture has thickened • While there are still more checks to be processed, do the following five steps • Repeat steps 1, 2, and 3 until the value of y is equal to 11 Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  20. Algorithms • We use algorithms all the time • Examples ? • Following directions • Programming a DVD • Adding two numbers • Finding Greatest Common Divisor Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  21. Invitation to Computer Science, 6th Edition

  22. Invitation to Computer Science, 6th Edition

  23. The Definition of Computer Science (continued) • Why are formal algorithms so important in computer science? • If we can specify an algorithm to solve a problem, then we can automate its solution • Computing agent • Machine, robot, person, or thing carrying out the steps of the algorithm • Unsolved problems • Some problems are unsolvable, some solutions are too slow, and some solutions are not yet known Invitation to Computer Science, 6th Edition

  24. Algorithms • The Formal Definition of an 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 Invitation to Computer Science, 6th Edition

  25. Algorithms (continued) • Well-ordered collection • Upon completion of an operation we always know which operation to do next • Unambiguousoperation, or primitive • Can be understood by the computing agent without having to be further defined or simplified • Ambiguous statements • Go back and do it again (Do what again?) • Start over (From where?) Invitation to Computer Science, 6th Edition

  26. Algorithms (continued) • It is not enough for an operation to be understandable it must also be doable (effectively computable)by the computing agent • Algorithm must produce a result (not always an answer) after the execution of a finite number of operations • Result may be a number, text, a light, picture, sound, or a change in the computing agent’s environment • Must halt in finite time • Runs forever: called an infinite loop • Usually a mistake, often a design error Invitation to Computer Science, 6th Edition

  27. Example of an Algorithm? • Well-ordered- clear and unambiguous ordering – we always know what to do next. ( See pp. 12-16) “Shampooing Algorithm” Step 1 Wet Hair Step 2 Lather Step 3 Rinse Step 4 Repeat Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  28. Invitation to Computer Science, 6th Edition

  29. Shampoo Multiple Times- More “elegant” useful and efficient Invitation to Computer Science, 6th Edition

  30. Algorithms (continued) • The Importance of Algorithmic Problem Solving • “Industrial revolution” of 19th century • Mechanized and automated repetitive physical tasks • “Computer revolution” of the 20th and 21st centuries • Mechanized and automated repetitive mental tasks • Through algorithms and computer hardware • Algorithmic solutions can be: • Encoded into some appropriate language • Given to a computing agent to execute Invitation to Computer Science, 6th Edition

  31. Why Are Algorithms So Important? • If we can specify an algorithm to solve a problem then we can automate its solution. • The machine, robot, person or thing that carries out the steps of the algorithm is called a computing agent. Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  32. Algorithmic Problem Solving • Can all problems be solved algorithmically? NO! • There are problems which have no generalized solution – unsolvable or intractable • Some with an algorithm would take so long to execute that the algorithm is useless • Some problems we have not yet discovered an algorithm for • Kurt Godel (1930’s) - See Chapter 12 Invitation to Computer Science, 6th Edition, Modified by SJF, 2012

  33. Organization of the Text Invitation to Computer Science, 6th Edition

  34. Invitation to Computer Science, 6th Edition

  35. 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 Invitation to Computer Science, 6th Edition

More Related