Algorithm to tell if two arrays have identical members.
Posted
by nickf
on Stack Overflow
See other posts from Stack Overflow
or by nickf
Published on 2008-10-29T01:33:44Z
Indexed on
2010/03/11
21:24 UTC
Read the original article
Hit count: 163
algorithm
What's the best algorithm for comparing two arrays to see if they have the same members?
Assume there are no duplicates, the members can be in any order, and that neither is sorted.
compare(
[a, b, c, d],
[b, a, d, c]
) ==> true
compare(
[a, b, e],
[a, b, c]
) ==> false
compare(
[a, b, c],
[a, b]
) ==> false
© Stack Overflow or respective owner