Ass04 - S v so it’s the least common ancestor in T of all leaves below v in S Give an algorithm to compute M 3 The Set Cover(SC problem is

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Fall 2011 CS 513: #4 Farach-Colton Due by the beginning of class, Oct. 4. 1. The Longest Common Prefix problem is defined as follows: Preprocess: D = { S 1 ,...,S n } ,S i Σ m , that is D is a set of n strings, each of which is of length m . Queries: LCP ( i,j ) returns k if S i [1 ...k ] = S j [1 ...k ] but S i [ k +1] 6 = S j [ k +1]. One trivial algorithm is to do no preprocessing and then simply scan string to find the LCP at query time. However, suppose you were building a system where queries where very frequent. Give an algorithm for this problem which answers queries in constant time. The faster the preprocessing the better. 2. Given a rooted tree T , define T ( v ) to be the set of leaves below node v in T . For a set of nodes V 0 , define LCA T ( V 0 ) to be the shallowest node u in T such that u = LCA ( w,x ), for w,x V 0 . Given two rooted trees S and T with the same leaf labels, define, for each node v in S , M ( v ) = LCA T
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ( S ( v )), so it’s the least common ancestor in T of all leaves below v in S . Give an algorithm to compute M . 3. The Set Cover (SC) problem is defined as follows: Input: A collection C of subsets of a finite set S , and a postive integer K ≤ | C | . Output: Yes, if there is a subsets C of C such that | C | ≤ K and ∪ c ∈ C c = S, No, otherwise. The Vertex Cover (VC) problem is defined as follows: Input: A graph G = ( V,E ) and a postive integer K ≤ | V | . Output: Yes, if there is a subsets V of V such that | V | ≤ K and for every edge { a,b } ∈ E , { a,b } ∩ V 6 = 0 No, otherwise. Show that if there is a polynomial time algorithm for SC, there is a polynomial time algorithm for VC....
View Full Document

This document was uploaded on 12/18/2011.

Ask a homework question - tutors are online