I have the following data set:
(234,565,678,90,66,7,8,44,5) (275,23,54,34,5) (4745,23,54,4,556,65,89,5,4,569,87,412) (75,273,59,5,4,567,412) (44,34,556,69,5,4,569,812)
Each array represents a web session. Each element in the array represents an activity that the user performed during the session.
What is shown above is just a subset of the entire array list (which consists of over a million arrays).
My job is to deliver the next elementgiven across all arrays an item or a list of items,
Here is an example: if
(234) given, I have to return
565 because (234) matches the first element of the first array. So I have to return the following
But I also need to be able to return a result with a number of elements, like this: if
(275,23,54) given, I have to return
(275,23,54) matches the first three elements of the second array, and
34 follow that.
This can be done fairly easily in a Java-like language if I cache the entire record in memory and then search through it. However, my challenge is to store and search them using a database. I tended to key / value databases like Redis. My challenge here is that I don't have a "good" key here. My input could be any of the elements in any Array or list of elements.
What would be the best way to save and search for this?