Obvious answers would be:
- Sort both lists, then check each
element to see if they’re identical - Add the items from one array to a
hashtable, then iterate through the
other array, checking that each item
is in the hash - nickf’s iterative search algorithm
Which one you’d use would depend on whether you can sort the lists first, and whether you have a good hash algorithm handy.