Given a character text string, there may be substring patterns in the text.
Text: "This is a test string to search patterns in", Patterns: "is a", "sea", "string", "ring".
Write a function (or describe the algorithm) that finds multiple patterns in such a text.
What is the complexity of your solution? Can you describe an algorithm that visits each byte in the text just once? The speed of the solution is important.