Question: Question 6: You are given a string X of length n and another string Y of length m . The task is to count how

Question 6: You are given a string X of length n and another string Y of length m. The task is to count how many index-disjoint sub-sequences of X are the same as Y . Thus, if X = GAXTYAWBGTAUGBTABGRGTAXB and Y = GTAB, then the answer is 3 as shown by the bold fonts. Notice that we cannot select the italicized GTAB as it overlaps with a bold GTAB, i.e., among overlapping sub-sequences that form Y , you can select only one of them. Describe an O(m + n) time greedy algorithm to obtain the count. Write a pseudo-code.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!