Consider the following problem:
There are two arrays A and B with equal number of elements (say each element is 32-bit signed integer). Now I have to estimate if arrays A and B are exact duplicates of each other (notwithstanding the order of the elements). Example: A={1,3,4,4} is the exact duplicate of B={4,3,1,4}
For sake of my question, assume that we cannot solve this exhaustively or by using a hashtable. Now, I define some operator (say R - which is both commutative and associative) which when applied to the elements of A and the elements of B give the same output V. However, V should be obtained only by this combination of elements.
As a side, I want to know if a combination of XOR and OR satisfies criteria for operator R. Essentially, I find XOR_A and XOR_B (A and B being the arrays). Also I find SUM_A and SUM_B. If XOR_A = XOR_B and SUM_A = SUM_B, can I say that the two arrays are exact duplicates.
If above is not true, is there any such operator R ?