Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Science 101 Theory of Computing. Computer Science is... The study of algorithms, with respect to –their formal properties –their linguistic realizations.

Similar presentations


Presentation on theme: "Computer Science 101 Theory of Computing. Computer Science is... The study of algorithms, with respect to –their formal properties –their linguistic realizations."— Presentation transcript:

1 Computer Science 101 Theory of Computing

2 Computer Science is... The study of algorithms, with respect to –their formal properties –their linguistic realizations (in programming languages, from Python down to machine code) –their hardware realizations (machine architecture, logic circuits, transistors)

3 Things to Desire in an Algorithm Correctness Maintainability Efficiency

4 Wait, can it be solved? There are problems that do not have any algorithmic solution! Algorithms are carried out by computing agents What can these agents do, and what can’t they do?

5 What is a model? Models –Capture the essence of the real thing –Probably differ in scale from the real thing –Omit some of the details of the real thing –Lack the full functionality of the real thing

6 A Model of a Computing Agent Computing agent should be able to: –Accept input –Store information in and retrieve it from memory –Take actions according to algorithmic instructions –Produce output

7 The Turing Machine Developed by Alan Turing to demonstrate theoretical properties of computation 1935, before real computers Still the theoretical basis of computing

8 The Turing Machine Developed by Alan Turing to demonstrate theoretical properties of computation 1935, before real computers Still the theoretical basis of computing

9 Components of a TM Memory – a paper tape to which symbols can be written or from which they can be read States – a set of descriptions of actions to be performed (reading, writing, and moving the read/write head on the tape) Alphabet – a set of symbols to be input or output

10 The TM Tape Consists of squares in which symbols are written Extends an infinite distance in both directions (can always buy more tape) Can read or write a symbol from/to one square at a time

11 The Read/Write Head and States At startup, the read/write head (the arrow) is placed next to a square on the tape State 1 says “if the tape symbol is a 0, write a 1, move one square to the right, and go into state 2”

12 The Read/Write Head and a State The change from one state to the next one is called a transition On each transition, an input symbol is read, an output symbol is written, the read/right head moves left or right, and the machine goes into the next state

13 The Read/Write Head and a State Sometimes, the current state and the next state are the same (like a loop) Sometimes, the input and output symbols are the same The alphabet can contain any symbols

14 What Can a TM Do? Can execute a whole sequence of instructions Can accept input Can store information in and retrieve it from memory Can take actions according to algorithm instructions Can produce output

15 A Model of an Algorithm An algorithm must: –Be a well-ordered collection –Consist of unambiguous and effectively computable operations –Halt in a finite amount of time –Produce a result

16 Turing Machine Examples Turing machine –Must begin in state 1 on the leftmost nonblank cell –Machine state 1 must be a state in which 0s are changed to 1s and 1s are changed to 0s

17 Bit Inverter State diagram –Visual representation of a Turing machine algorithm –Circles represent states, and arrows represent transitions from one state to another

18 Invert the Bits This TM needs another transition, which reads a blank, writes a blank, moves left, and goes into State 2 State 2 then has no transitions (no actions), so it’s the halt state

19 Tuple Representation of States A state can also be represented as a set of tuples Each tuple has the form IN OUT NEXT DIR States for the bit inverter TM: IN OUT NEXT DIR 0 1 1 R 1 0 1 R b b 2 L State 1 State 2 (halt state)


Download ppt "Computer Science 101 Theory of Computing. Computer Science is... The study of algorithms, with respect to –their formal properties –their linguistic realizations."

Similar presentations


Ads by Google