@UMarius: A = {1,2}, B = {2,1} fails your test. If you reread the
original problem, you see that the question is not whether the arrays
are identical (which is easily determined by simply comparing them
element-by-element in O(n)), but whether they contain the same values,
possibly in a different order.Dave On Aug 21, 11:01 am, UMarius <[email protected]> wrote: > What about this? > > 1. xor all elements of each array and their corresponding indexes & > sum all the elements of each array & mul all elements of each array > 2. if all results are the same then the arrays are identical > > Nice to "meet" you all, I just joined and this is my first post :) ... > > > > > Given two arrays of numbers, find if each of the two arrays have the > > same set of integers ? Suggest an algo which can run faster than NlogN > > without extra space?- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
