This is my take on solving this (if I understand the spec right that is) using a finite state automaton to look for a specific arbitrary-length sequence of characters from a stream. It does not need to store any data at all except the string to look for and an array of bits of same length.
As an example the input stream is a seemingly infinite sequence of random numbers between 0 and 9.The sequence to detect is '0,1,2,3,4,5'.
For a seed of '123' this is encountered on the 151436th rand() call!
./detector.pl
In reply to Re: Algorithm inspiration required.
by bliako
in thread Algorithm inspiration required.
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |