[Haskell-cafe] O(n) algorithm for determining subset

Michael Mossey mpm at alumni.caltech.edu
Sun Nov 15 15:54:11 EST 2009

Can someone tell me if this is correct. I'm guessing that if I represent
two sets of integers by Word32 (where ith bit set means i is in the set),
then an algorithm to determine if x is a subset of y would go something

  (y - x) == (y `exclusiveOr` x)

More information about the Haskell-Cafe mailing list