INVITATION TO Computer Science 1 Chapter 1An Introduction to Computer Science

Invitation to Computer Science, 6th Edition Introduction • 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 2

Invitation to Computer Science, 6th Edition The Definition of Computer Science•Computer science isthe study of algorithms, including: – Their formal and mathematical properties – Their hardware realizations – Their linguistic realizations – Their applications •Abu Ja’far Muhammad ibn Musa Al-Khowarizmi (AD 780-850?), Persian Author 3

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

Invitation to Computer Science, 6th Edition 5

Invitation to Computer Science, 6th Edition 6

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

Invitation to Computer Science, 6th Edition 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 Shampooing instructions: –STEP 1Wet hair –STEP 2Lather –STEP 3Rinse –STEP 4Repeat 8

Invitation to Computer Science, 6th Edition Algorithms (continued)•Well-ordered collection – Upon completion of an operation we always know which operation to do next •Ambiguous statements – Go back and do it again (Do what again?) – Start over (From where?) 9

Invitation to Computer Science, 6th Edition Algorithms (continued)• Unambiguousoperation, or primitive– Can be understood by the computing agent without having to be further defined or simplified •It is not enough for an operation to be understandable – It must also be doable(effectively computable)by the computing agent Finding 100thPrime Number?