Question: Problem 1 [20]: Given a collection S = {S, S2, ..., Sk} of k = 0(1) strings with total length Si = n, design
Problem 1 [20]: Given a collection S = {S, S2, ..., Sk} of k = 0(1) strings with total length Si = n, design an O(n)-time algorithm to return the number of distinct strings that occur as substrings of exactly two elements of S. For example, for S = {abaabb, abba, bbaaa}, the algorithm should return 5 (the sought set of strings is {ab, abb, bba, aa, baa}). Write the pseudo-code of your solution (excluding construction of structures introduced in lectures), prove its correctness, and analyze its complexity.
Step by Step Solution
3.55 Rating (155 Votes )
There are 3 Steps involved in it
Algorithm to Find Distinct Substrings Occurring in Exactly Two Strings Input Collection of k strings ... View full answer
Get step-by-step solutions from verified subject matter experts
