@UMarius: I'm sounding like a broken record. Rather than challenging everyone to keep coming up with counterexamples, please provide a rationale as to why an algorithm such as this should work. It looks as if you have two equations in 2N unknowns and are trying to assert that the only solution is A_1 = B_1, A_2 = B_2, etc. (where I have assumed that each array is sorted). Usually, it takes 2N equations to determine 2N unknowns, although other information about the solutions can lessen that number in certain circumstances.
At least if you are going to propose something, do so only after you have tested it on all of the combinations of up to four numbers between -5 and 5. 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.
