I have a linear list of zeros and ones and I need to match multiple simple patterns and find the first occurrence. For example, I might need to find 0001101101,
A solution that could be efficient:
pattern_length chars are in the trie, stop on success ( O(1) operation )If the list isn't mutable you can store the offset of matching patterns to avoid repeating calculations the next time.