in reply to How do I compare two arrays?

This is the most efficient possible implementation, as given appropriate hardware it returns in constant time even for really large arrays. All other solutions are at least O(n).
use Quantum::Superpositions; @a2 = eigenstates(any(@a2) != all(@a1));
How this works is left as an exercise for the reader, as you wouldn't want to submit this answer for your homework without explaining how it works.

Replies are listed 'Best First'.
Re: How do I compare two arrays?
by Abigail-II (Bishop) on Mar 09, 2004 at 11:55 UTC
    This is the most efficient possible implementation, as given appropriate hardware it returns in constant time even for really large arrays. All other solutions are at least O(n).
    Eh, no, actually. With Θ (n2) processors, you can solve this in Ο (log n) time. And that's with off-the-self processors, not some hardware which is unlikely to be ever build.

    Abigail