algorithm - How do I detect the "conversation" pattern in SQL? -


In fact, this is not specific to SQL, and I suspect that "Conversation Pattern" is the correct name, but I could not have thought of a better caption.

To make it simple, imagine you got a huge flow. The job is to a {1; Max_N} A pattern is detected: If any N (> 0) is followed by other ints, then the original reversal again, while n & lt; = Max_n.

Example:

  ... 4 4 <- 7> 3> N = 3 3/4  - 2 ...  

Here, int 4 is triggered in the middle of 3 arbitrarily inset, so for max_n & lt; Pattern is satisfied for = 3 value 4 .

The question is how can I follow the figures, can detect the numbers of huge integers in the dumps? I am mostly interested in algorithms, but you also welcome an example in SQL or C #.

The experience I have gained is to first collect a list or all the different points, then check the patterns in each simple manner for each of them, but this will hamper a performance.

You can hold some dictionary (C #) or map (C ++) structures Where the status of the first incident of numbers will be saved.

Then for each number, you should check if it is present in the map. If yes - you should compare the position difference with maximum position difference, otherwise you need to save the number and position of the map.


Comments

Popular posts from this blog

google indexing -

wpf - Custom Message Box Advice -

Eclipse CDT variable colors in editor -