I have, for example, 5 arrays with some elements (numbers) inserted:
1, 4 , 8,10
1,2,3, 4 , 11,15
2, 4 , 20,21
2 , 30
I need to find the most common elements in these arrays, and each element must go all the way to the end (see example below). In this example, it would be a bold combination (or the same one, but with β30β at the end, it is βthe sameβ) because it contains the least amount of different elements (only two, 4 and 2/30).
This combination (see below) is not good, because if I have for ex. "4" it should "go" to the end (the next array should not contain "4" at all). Thus, the combination must go all the way to the end.
1, 4 , 8,10
1, 2 , 3,4,11,15
2 , 4,20,21
2 , 30
EDIT2: OR
1, 4 , 8,10
1,2,3, 4 , 11,15
2 , 4,20,21
2 , 30
OR something else SHOULD NOT.
Is there any algorithm to speed up this thing (if I have thousands of arrays with hundreds of elements in each)?
: , ( ) - - . 4,4,4,2 , 4,2,2,2, 4 , 2.
: . , . , ,
1,2,3
1,4,5
4,5,6
1,1,4 1,1,5 1,1,6 2,5,5, 1 ( ), 2 ( ).
.
EDIT3: : (
EDIT4: @spintheblack 1,1,1,2,4 - , , (, 1), ( 1). , ""? , ( ), - , , .