You are given a string and an array of strings. How to quickly check, if this string can be built by concatenating some of the strings in the array?
This is a theoretica
Let me suggest using Suffix Trees (using Ukkonen's online algorithm to build it) which seems to be suitable in terms of searching common substrings in two texts. You could find more information in wikipedia/special sources. The task is
Find all z occurrences of the patterns P1..Pn of total length m
enter code hereas substrings in O(m + z) time.
so you see there exists very cool solution. Hope this will work for you. This is actually more suitable for repeating scans, rather than a single scan.