# t9 - T of a relation R given the relation R as a matrix 5(a...

This preview shows pages 1–2. Sign up to view the full content.

CS3230 Tutorial 9 1. Compute the longest common subsequence of (a) SLWOV NNDK and ALWGQV NBBK . (b) AGCGATAGC and ACAGATGAG 2. Show that if X and Y are two sequences starting with a , then the longest common subsequence of X and Y starts with an a . 3. Give a counterexample to the following claims: (a) If X = X [1] ...X [ m ] and Y = Y [1] ...Y [ n ], and X [ m ] 6 = Y [ n ], then the longest common subsequence of X and Y must end in either X [ m ] or Y [ n ]. (b) If X = X [1] ...X [ m ] and Y = Y [1] ...Y [ n ], and X [ m ] 6 = Y [ n ], then the longest common subsequence of X and Y must not end with either X [ m ] or Y [ n ]. 4. Consider the following problem: A relation on a set A is a subset of A × A . A relation T is called transitive if the following holds for all a,b,c A : if ( a,b ) T and ( b,c ) T , then ( a,c ) T . A relation T is called a transitive closure of a relation R on a set A if it is the smallest rela- tion (on A ) which is a superset of R and is transitive. In other words, ( a,b ) is in T iﬀ there exist b 1 ,b 2 ,...,b k such that, a = b 1 ,b = b k , and ( b 1 ,b 2 ) , ( b 2 ,b 3 ) , ( b 3 ,b 4 ) ,..., ( b k - 1 ,b k ) are all in R (here k may be equal to 2). Give a dynamic programming algorithm to compute transitive closure

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: T of a relation R , given the relation R as a matrix. 5. (a) A Chomsky Normal Form grammar G is of the form G = (Σ ,V,S,δ ), where Σ is the alphabet set, V is a set of non-termimals (where V ∩ Σ = ∅ ), S ∈ V is a starting symbol and δ is a set of productions of the form: A → BC or A → a , where A,B,C ∈ V and a ∈ Σ is a terminal. In the following α,β,γ,w are strings in (Σ ∪ V ) * . 1 (b) We say that αAβ ⇒ G αwβ , where A → w is a production in G (that is member of δ ). (c) We say that α ⇒ * G β if one of the following holds: (i) α = β , (ii) α ⇒ G β or (iii) for some γ , α ⇒ G γ and γ ⇒ * G β . (d) We say that L ( G ) = { w : w ∈ Σ * and S ⇒ * G w } . Given a Chomsky Normal Form grammar G , give a dynamic programming algorithm to determine if a string w ∈ Σ * is a member of L ( G ). 2...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

t9 - T of a relation R given the relation R as a matrix 5(a...

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

View Full Document
Ask a homework question - tutors are online