I have the following question, can you please help me with it:
I have the following arrays of integers (size 1024) and I trying to find common elements present in all the arrays (along with the position at which the common element was found):
Array1: 15, 89, 100, 167, 202, ...
Array2: 16, 89, 109, 178,179, 202, ...
Array3: 15, 89, 100, 178, 189, 202, ...
Array4: 17, 89, 109, 167, 178, 202, ...
Array5: 7, 89, 100, 178, 179, 180, 202, ...
Now the common elements along with their position in the respective arrays are:
Array1: 89(2), 202(5), ...
Array2: 89(2), 202(6), ...
Array3: 89(2), 202(6), ...
Array4: 89(2), 202(6), ...
Array5: 89(2), 202(7), ...
Is it possible to keep these arrays in L1 cache while the arrays are getting intersected. I have written a simple C++ code which pushes the common element and its position as an std::pair into an std::vector. Is this code correct to keep the elements in L1 cache or should I modify my code...if yes, then please suggest.