• 沒有找到結果。

Hamiltonian Path I

N/A
N/A
Protected

Academic year: 2022

Share "Hamiltonian Path I"

Copied!
10
0
0

加載中.... (立即查看全文)

全文

(1)

Hamiltonian Path I

For some problems it is difficult to find an algorithm in P

We first discuss an example of finding a Hamiltonian Path

Definition: for a given directed graph find a path going through all nodes once

Fig 7.17

(2)

Hamiltonian Path II

s t

HAMPATH = {hG , s, ti | G : directed, a Hamiltonian path from s to t}

A brute-force way: checking all possible paths But the number is exponential

Polynomial verification

(3)

Hamiltonian Path III

This is an example where verification is easier than determination

(4)

Compositeness I

We discuss another example where verification is easier than determination

An integer is composite if

x = pq, p > 1, q > 1 Given x , difficult to find p, q

Given x , p, q easily verify x = pq or not

(5)

Not polynomial verifiable I

Some problems are difficult so even a polynomial verifier cannot be easily obtained

HAMPATH: given hG , s, ti no Hamiltonian path from s to t

Verification may still be difficult

Given s and t it seems we still need to check all paths

(6)

Verifier I

Definition: an algorithm V is a verifier of a language A if

A = {w | V accepts hw , ci for some strings c}

Example: compositeness. V accepts hw , ci = hx, pi, where p is a divisor Example: Hamiltonian path. V accepts

hw , ci = hhG , s, ti, a path from s to ti

(7)

Verifier II

Definition: a polynomial verifier if it takes polynomial time of |w |

A: polynomially verifiable if ∃ a polynomial verifier Note that we measure time on |w | without

considering |c|

For a polynomial verifier, |c| should be in polynomial of |w |

Otherwise, reading |c| already non-polynomial

(8)

NP I

NP is a class of languages

Definition: a language ∈ NP if it has a polynomial verifier

We will prove that this definition is equivalent to that the language is decided by nondeterministic polynomial TM

This is where the name comes from Some use this as the definition

Note that for nondeterministic TM the running time

(9)

NP II

Definition:

NTIME(t(n))

={L | L decided by O(t(n)) nondeterministic TM}

NP = ∪kNTIME(nk)

(10)

NTM for HAMPATH I

A list p1· · · pm is nondeterministically chosen For each list:

1 Check repetitions

2 Check s = p1; t = pm

3 Check that for i = 1 . . . m − 1, (pi, pi +1) is an edge of G

Cost on each list is polynomial:

repetitions: O(m2) s = p , t = p : O(m)

參考文獻

相關文件

Find the power series representation of f in powers of x.. Find the radius

• Suppose, instead, we run the algorithm for the same running time mkT (n) once and rejects the input if it does not stop within the time bound.. • By Markov’s inequality, this

• By definition, a pseudo-polynomial-time algorithm becomes polynomial-time if each integer parameter is limited to having a value polynomial in the input length.. • Corollary 39

• By definition, a pseudo-polynomial-time algorithm becomes polynomial-time if each integer parameter is limited to having a value polynomial in the input length.. • Corollary 42

As summarized in the following theorem, we resolve this open problem by augmenting Chudnovsky et al.'s even ‐hole detection algorithm into the first known polynomial ‐time

• A language has uniformly polynomial circuits if there is a uniform family of polynomial circuits that decide

In Sec- tion 4, we introduce these basic ideas by developing dynamic-programming solu- tions for problems from different application areas, including the maximum-sum segment

(1) In this exercise, you are going to prove the fundamental Theorem of algebra: any nonconstant complex polynomial must have a root in C. Let us prove it by