hw12s.f11

hw12s.f11 - Fall 2010 ECE608, Homework #12 Solution (1) CLR...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Fall 2010 ECE608, Homework #12 Solution (1) CLR 34.1-1 (a) If Longest-Path P, then we can come up with an algorithm Longest-Path- Length ( G, u, v ). Longest-Path-Length ( G, u, v ) 1. for k = | V | 1 to 1 2. do Ans = Longest-Path ( G, u, v, k ) 3. if ( Ans = yes) 4. return k /* path exists */ 5. return 0 /* path does not exist */ If Longest-Path runs in polynomial time, so does Longest-Path-Length . (b) If Longest-Path-Length P, then we also can come up with an algorithm Longest-Path ( G, u, v, k ). Longest-Path ( G, u, v, k ) 1. Opt Longest-Path-Length ( G, u, v ) 2. if k > OPT 3. return No 4. else return Yes Similarly, if Longest-Path-Length runs in polynomial time, so does Longest- Path . From (a) and (b) , we can conclude that Longest-Path P if and only if Longest- Path-Length P. (2) CLR 34.1-6 Assume that L, L 1 , L 2 P . The following statements hold: L 1 L 2 P since we can decide if x L 1 L 2 by deciding if x L 1 and then if x L 2 . If either holds then x L 1 L 2 otherwise it is not. L 1 L 2 P since we can decide if x L 1 and then if x L 2 . If both hold then x L 1 L 2 otherwise it is not. L P since x L x / L L 1 L 2 P . Given a string x of length n denote its substring from index i to j by x ij . We can then decide x by deciding x 1 k L 1 and x ( k +1) n L 2 for all the n possible values of k 1 L P . We can prove this by showing that the result holds for L k for all k and thus for k i =0 L k . We will use induction on k . If k = 0 we only consider the empty language and the result is trivial. Assume that L k P and consider L k +1 = LL k . The above result on concatenation gives us that LL k P . (3) CLR 34.2-1 Suppose the certificate y used to verify the language GRAPH ISOMORPHISM is in the form of two lists of vertices v 1 , v 2 , v 3 , ..., v n in G 1 and u 1 , u 2 , u 3 ,..., u n in G 2 with v i corresponding to u i ( i = 1 , 2 , ..., n ). Use DFS (or other polynomial-time algorithms) to explore all the edges in G 1 . Once an edge ( v i , v j ) is found in G 1 , we check in G 2 if there is an edge between u i and u j . If there is, we just go on. If not, G 1 and G 2 are not isomorphic because there isnt an corresponding edge between u i and u j in G 2 for ( v i , v j ) in G 1 ; we stop and return false. After we explore all the edges in G 1 and all the edges in G 1 have their corresponding edges in G 2 , we do the same thing again by exploring all the edges in G 2 and checking if every edge in G 2 has its corresponding edge in G 1 . If every edge in G 1 ( G 2 ) has its corresponding edge in G 2 ( G 1 ), we can make the conclusion that G 1 and G 2 are isomorphic and return TRUE. Otherwise, they are not isomorphic with the certificate y , and this algorithm will return FALSE....
View Full Document

Page1 / 7

hw12s.f11 - Fall 2010 ECE608, Homework #12 Solution (1) CLR...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online