Loading in 5 sec....

CS1000 Introduction to Computer SciencePowerPoint Presentation

CS1000 Introduction to Computer Science

- 101 Views
- Uploaded on
- Presentation posted in: General

CS1000 Introduction to Computer Science

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

CS1000Introduction to Computer Science

Instructor

Soufiane Noureddine

Lectures

Tu/Th: 12:15-13:30 (B650)

Office Hours

Tu/Th: 11:00-12:00 (C520)

- Computer Science (CS) = Study of Computers?
- CS began earlier than computers (branch of math)
- Theoretical CS (pencil and paper)
- Computer is only the basic tool in CS (e.g. beaker for chemistry, microscope for biology etc.)

- CS = Study of how to write programs?
- Use of programming languages e.g. Pascal, Lisp, C, etc.
- Very important but also only a tool in CS for verifying ideas and concepts after their analysis.
- Example: “Searching in a list”
- Analyze the problem
- Design a searching method
- Write a program
- Get quantitative and qualitative results.

- CS = Study of computer applications and software?
- Application: e.g. spreadsheets, word processors, databases …
- Comparison:
- Mechanical Engineer Computer Scientist
Conceives a car conceives computer/software

Builds and tests it builds and tests it

- User
Gets a driver license Gets some certificate

Drives the car Exploits the computer/software

- Mechanical Engineer Computer Scientist

- No real consensus (yet).
- A good definition that emphasizes the notion of “algorithm” is:
- CS is the study of algorithms including their:
- Formal and mathematical properties
- Hardware realizations
- Linguistic realizations
- Applications

- CS is the study of algorithms including their:

- Informally: Effective and precise recipe to get the result for some problem:
- “Recipe”: Set of commands/instructions
- “Effective”: The result is obtainable after some time
- “Precise”: exactness, only understandable and doable commands

- “Breakfast”
- 1. Get a slice of bread
- 2. Butter it
- 3. Eat the buttered slice
- 4. If still hungry then resume from step 1, otherwise drink a cup of tea and stop.

- Backing a pie
- Using the telephone set
- Programming the VCR
- Doing tax calculation
- …

- 1 + 2 + 3 + … + n ?
- Algorithm
- 1. Get the number n
- 2. Set m to n+1
- 3. Set n to n multiplied by m
- 4. Divide n by 2
- 5. Display the result n

- Inventor: Abu Jaafar Mohammed Ibn-Musa Al-Khawarizmi
- Arabic mathematician of the 8th century
- Born in Khawarizm (Persia)
- Lived in Baghdad where he worked in Beitu Alhikma (House of Wisdom) under the Khalif Al-Maamoon.
- Wrote two famous books:
- One is a treatise on the calculation using Arabic numerals, his name was translated in Latin to Algorismus, from there the word algorithm.
- The other is even more famous since it introduced “algebra” as a new fundamental branch of mathematics.
The book is Kitab Aljabr Wal Muqabala (Book of Restoration and Reduction) -> Aljabr had been translated to Algebra.

- The main benefit of algorithms is that we can automate the solution for every problem we can find an algorithm for solving it.
- Formal definition of 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.

- Well-ordered collection
- We have to always know what to do next.
- Counterexample:
- 1. Get a slice of bread
- 2. Butter it
- 3. Eat buttered slice
- 4. Repeat
-> 4th step: repeat what?

-> not an algorithm!

- Unambiguous + effectively computable operations
- Operations: units of work the computer can do.
- Different levels of operations are possible:
- Example: “Breakfast”
- 1. Eat buttered bread until “full”
- 2. Drink a cup of tea
- 3. Stop

- -> Step 1 may be too “high” for a kid
- Step 1 is a sequence of (sub-)operations, it also forms an algorithm!
- Possible algorithm for Step 1:
- 1. Get a slice of bread
- 2. Butter it
- 3. Eat the buttered slice
- 4. If still hungry resume from 1

- Example: “Breakfast”

- Operations should be unambiguous
- directly doable
- need not be further explained (e.g. using sub-operations)
- Unambiguous operations are also called primitives

- Any operation must be doable
- Unambiguous (understandable) but not doable operations are not welcome for algorithms
- Hence only effectively computable operations should be used

- Examples of unambiguous but not effectively computable operations:
- List all positive numbers
- Divide by 0
- Compute for ever
- Print the exact value of p

- Any algorithm should produce a result observable to the end user.
- Result may be:
- Answer
- Error message
- …

- And halts in a finite amount of time
- Practically one of the most crucial properties of algorithms
- Algorithms that work well but cannot stop are useless
- Example: “Endless Loop”
- 1. Get a slice of bread
- 2. Butter it
- 3. Eat the buttered slice
- 4. Repeat from step 1
- 5. Drink a cup of tea
- 6. Stop

- Common flaw in the design of algorithms: Endless loops