I cant remember from my days in college, the way to compare two unsorted arrays of int and find the number of matches ?
Each value is unique in it own array, and both arrays are the same size.
for example
int[5] a1 = new []{1,2,4,5,0}
int[5] a2 = new []{2,4,11,-6,7}
int numOfMatches = FindMatchesInPerformanceOfNLogN(a1,a2);
any one does remember ?
One array must be sorted so that you can compare in n*log(n). That is for every item in the unsorted array (n) you perform a binary search on the sorted array (log(n)). If both are unsorted, I don’t see a way to compare in n*log(n).