Only if they are non-negative integers...The positive integers can be mapped 1-to-1 on the entire set of integers (both sets have the same cardinality). You can construct a mapping so that the bit index is unique for any integer. For example:
Then $index is non-negative even for positive integers, and non-negative odd for negative integers.my $index = ( $integer >= 0 ) ? 2 * $index : -2 * $index - 1;
BTW, there is an interesting idea for Bottle Golf at Aleph-0 on Mathworld.
-QM
--
Quantum Mechanics: The dreams stuff is made of
In reply to Re^3: better union of sets algorithm?
by QM
in thread better union of sets algorithm?
by perrin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |