I am looking for a data structure for addressing content

I am trying to create a data structure that allows me to efficiently retrieve records from parts of their contents.

Let's say I'm looking for a record that matches this: [x 2 3 xx]

If [0 2 3 4 5 ]or [3 2 3 7 8 ]are in my data structure, they must be returned by the search function.

I wrote such a data structure, where I compare the "template" with all the elements of the data structure, but, of course, it takes too much time. I have few ideas on how to do this faster, but they are pretty hard to implement. Does something like this already exist? If not, how would you do it?

+3
source share
4 answers

The first thing that comes to mind is to have a hash table for each position in the tuple. To search, you cross the results for all positions with a given value.

+5
source

Well, the suffix tree could do this in O (1), but it would take a lot of memory.

+4
source

, , .

+2

RETE. 70- ; 14 . (IIRC , , .)

0

Source: https://habr.com/ru/post/1704950/


All Articles