ass04 - S v so it’s the least common ancestor in T of all...

Info icon This 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 ) =
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern