Using Rabin-Karp to search for multiple patterns in a string
According to the wikipedia entry on Rabin-Karp string matching algorithm, it can be used to look for several different patterns in a string at the same time while still maintaining linear complexity. It is clear that this is easily done when all the patterns are of the same length, but I still don't get how we can preserve O(n) complexity when searching for patterns with differing length simultaneously. Can someone please shed some light on this? Edit (December 2011): The wikipedia article has since been updated and no longer claims to match multiple patterns of differing length in O(n). I'm