Theory of Computing: MAS 714 Hartmut Klauck
Theory of Computing: MAS 714 Hartmut Klauck
Lecture 1
MAS 714
Hartmut Klauck
Organization:
Lectures:
Tue 9:30-11:30 TR+20
Fr 9:30-10:30
Tutorial:
Fr:10:30-11:30
Exceptions: This week no tutorial, next
Tuesday no lecture
Organization
Final: 60%, Midterm: 20%, Homework: 20%
http://www.ntu.edu.sg/home/hklauck/MAS714.htm
Books:
Cormen Leiserson Rivest Stein: Introduction to
Algorithms
Sipser: Introduction to the Theory of
Computation
Arora Barak: Computational Complexity- A
Modern Approach
Computation
Computation: Mapping inputs to outputs in a
prescribed way, by small, easy steps
Example: Division
Div(a,b)=c such that bc=a
How to find c?
School method
Outline: Theory of Computing
ALGORITHMS
CRYPTOGRAPHY
MACHINE MODELS
UNCOMPUTABLE
FORMAL LANGUAGES
UNIVERSALITY
PROOF SYSTEMS
This course
First half: algorithms and data-structures
Second half: Some complexity, computability,
formal languages
NP-completeness
Computable and uncomputable problems
Time-hierarchy
Automata and Circuits
Algorithms
An algorithm is a procedure for performing a
computation
Algorithms consist of elementary
steps/instructions
Elementary steps depend on the model of
computation
Example: C++ commands
Algorithms: Example
Gaussian Elimination
Input: Matrix M
Output: Triangular Matrix that is row-equivalent to
M
Elementary operations: row operations
swap, scale, add
Algorithms
Algorithms are named after Al-Khwrizm
(Ab Abdallh Muammad ibn Ms al-Khwrizm)
c. 780-850 ce
Persian mathematician and astronomer
(Algebra is also named after his work)
His works brought the positional system of
numbers to the attention of Europeans
Algorithms: Example
Addition via the school method:
Write numbers under each other
Add number position by position moving a carry
forward
Elementary operations:
Add two numbers between 0 and 9
(memorized)
Read and Write
Can deal with arbitrarily long numbers!
Datastructure
The addition algorithm uses (implicitly) an
array as datastructure
An array is a fixed length vector of cells that can
each store a number/digit
Note that when we add x and y then x+y is at most
1 digit longer than max{x,y}
So the result can be stored in an array of length
n+1
Multiplication
The school multiplication algorithm is an
example of a reduction
First we learn how to add n numbers with n
digits each
To multiply x and y we generate n numbers
xi y 2i and add them up
Reduction from Multiplication to Addition
Complexity
We usually analyze algorithms to grade the
performance
The most important (but not the only)
parameters are time and space
Time refers to the number of elementary steps
Space refers to the storage needed during the
computation
Example: Addition
Assume we add two numbers x,y with n
decimal digits
Clearly the number of elementary steps
(adding digits etc) grows linearly with n
Space is also n
2n+10
n2/500
n log(n)/2