Given a string s, what is the most efficient way of identifying the shortest supersequence of s from a bag of strings? Also, the last character of s should match the last character of the superstring.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unless i misunderstood it, this problem is most certainly in P.
A naive approach would be:
It can be done in O(|B’|* max(|z|)) for z in B. Testing if a given string s is a subsequence of another string z can be done in O(|z|)
Where |x| means size of x.
You can combine those steps, but it’s O(|B| * max(|z|)) anyway.