I am trying to find a way to write an efficient algorithm to perform an unsorted intersection on two vectors / arrays, but with no luck. I work with one large, frantic array (usually between 500,000 and 1,000,000 values) and one relatively smaller (possibly 5,000 max values) Unique array.
I have seen many methods suggested here, including methods like unordered_sets, but in my opinion this does not work if one of the arrays is not unique. Secondly, instead of having an output vector that contains numbers common to both arrays, I would like the output vector to contain indices of these common values โโrelative to a larger array. So, if there are 5 locations in a larger array that are equal to one of the values โโin the smaller array, I need each of these 5 indexes. Maybe something similar to the python in1d function.
Does anyone have any ideas? Thanks
source share