I'm trying to design a data structure that allows efficient extraction of entries from a part of their content.
Let's say I am looking for an entry that matches this: [
x 2 3 x x ]
If [
0 2 3 4 5 ]
or [
3 2 3 7 8 ]
are in my data structure, they should be returned by my find function.
I wrote such a data structure where I compare the "pattern" against all entries of the data structure, but of course it takes way too much time. I have few ideas about how to do this a faster way but they are quite heavy to implement. Does something like this already exists? If not, how would you do this?