













































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














































Nondeterministic complexity The class NP Defined by… …acceptance by poly-time NTM’s …positive instance give poly-size proofs …acceptance by poly-time verifiers Examples in: Punch-Card Puzzle SAT (satisfiability of Boolean expressions) Variants: CSAT, nSAT The class Co- NP Polynomial time reductions
In general, the notches must always be there, as they go on 3 pegs, but holes may or may not be filled.
Pictured are punch cards on the pegs:
Q: Find a solution to this instance:
A: Solution is C1, C2, C3, flip(C4):
A: Solution is C1, C2, C3, flip(C4):
A: Solution is C1, C2, C3, flip(C4):
A: Yes. Here’s an algorithm: SolvePuzzle(cards C1, C2, … C n) for(i 1 = 0 to 1) if (i 1 = 1) flip C for(i 2 = 0 to 1) if (i 2 = 1) flip C … for(in= 0 to 1) if (in= 1) flip Cn put cards on pegs if (no holes) ACCEPT REJECT Q: Running time? Docsity.com
A: Running time: In worst case, reject, and have to go through all possible iterations:
possibilities so worst-case running time is W(2^ n). Therefore, the algorithm has exponential running time.
Q: Can you come up with a polynomial- time algorithm?
Recall that in a nondeterministic TM, a computation consists of a computation tree, whose branches from root to leaves are the various possible computations that could take place. DEF: The nondeterministic running time of a nondeterministic Turing machine N is the function f (n) which is the maximum number of transitions that N takes to halt (or crash) on any computation branch when given an arbitrary input of length n. Q: When is N said to be a decider?
Consider the NTM decider for (ab)*b(ab) (from lecture 16):
Q: What is the running time?
0 1 2 3
a|bR bR a|bR (^) • L
0 1 2 3
a|bR bR a|bR (^) • L
0ababa a0baba ab0aba ab1aba aba0ba
abab0a abab1a
aba2ba crash
ababa0•
crash
ababa2• abab 3 a•
We can define language classes based on nondeterministic TM’s just as we did with deterministic TM’s
DEF: Suppose that g (n) is a real function. The nondeterministic time complexity class NTIME(g (n) ) consists of all languages which are decided by some NTM with running time O(g (n)). Any such language is said to be of nondeterministic time complexity g (n).
Q: Give a simple function g (n) for which previous example was in NTIME(g (n) ).