Lecture 11. Introduction to Complexity Theory
Lecture 11. Introduction to Complexity Theory
- Operating Systems
- Software
Turing Machine
Lecture 11. Introduction to Complexity Theory 6
See https://youtu.be/E3keLeMwfHY
Lecture 11. Introduction to Complexity Theory 7
The Halting Problem: Can we write a program that will look at any
computer program and its input and decide if the program will halt
(not run infinitely)?
• The case that Turing came up with that can never be solved involves
giving a program itself as input.
Lecture 11. Introduction to Complexity Theory 10
• Examples:
- Does a given graph have a cycle?
- Are all the nodes of a given graph reachable?
- Does a text contain a pattern ?
- Does an instance of the Travelling Salesman Problem have a solution of
length at most ?
Lecture 11. Introduction to Complexity Theory 11
• The Turing Machine leaves YES on the tape when the string of
a language is acceptable, NO if not.
• A decision problem (or language) is decidable if there is a Turing
Machine that solves that problem.
• Example of a language:
- The problem of determining whether a number is divisible by 7
corresponds to the language of all strings that form numbers divisible by 7.
- The Turing Machine for divisibility by 7 solves the problem and represents
the language.
Lecture 11. Introduction to Complexity Theory 12
For example, 1 on the tape in state 3 might make the DTM write 0 on
the tape, move the head one position to the right, and switch to state 5.
Lecture 11. Introduction to Complexity Theory 13
• We can talk about how many steps it takes for them to reach a
solution for a given input.
• We then start to worry about how efficiently we can solve the
problem.
• We consider problems to be difficult if their solution requires a
lot of resources.
• We use models of their resource usage to allow us to compare
problems and various algorithms designed to solve them.
Lecture 11. Introduction to Complexity Theory 16
w1 w5
p1
p5
capacity
Lecture 11. Introduction to Complexity Theory 23
Example:
- for and ,
- there are two solutions: and .
P versus NP
Lecture 11. Introduction to Complexity Theory 28
• Decide whether there exists a subset that sums up the integers to the target
value .
• We can investigate all possible solutions in polynomial time assuming that
the non-deterministic Turing Machine can explore the whole "computation
tree" in parallel being in multiple states at once, i.e. it can parallelise the
search without any limitation.
Thus, we can solve the problem using the non-deterministic Turing Machine.
• Given an answer, we can check it in polynomial time just by summing up all
the integers of the subset provided in the answer.
Thus, we can verify the problem in polynomial time.
Lecture 11. Introduction to Complexity Theory 32
What can be solved using the deterministic can be sure solved with
the non-deterministic Turing Machine.
• One of the major open question in Computer Science: Is P=NP?
Most people believe that P≠NP (see http://www.win.tue.nl/~gwoegi/P-versus-NP.htm).
Lecture 11. Introduction to Complexity Theory 34
P: Decision problems that The left side is valid under the assumption that P≠NP, while
can be solved in polynomial time the right side is valid under the assumption
on a deterministic Turing Machine that P=NP
Lecture 11. Introduction to Complexity Theory 36
Decision problems:
- Hamiltonian Cycle problem
- Traveling Salesman problem
- Graph Colouring problem
- 0-1 Knapsack problem
- The Subset-Sum problem
- etc.
Implications:
• If we can solve NP-hard problem , then we can solve problem in the
class NP as efficiently as problem .
• Finding a polynomial algorithm to solve any NP-hard problem would
give polynomial algorithms for all the problems in NP.
Lecture 11. Introduction to Complexity Theory 38
• NP-hard, and