in reply to Re: Re: Algorithm Pop Quiz: Sorting
in thread Algorithm Pop Quiz: Sorting
The problem with xor on strings is it will extend short ones. There are now 0 bytes there that weren't there before, and length changes.
$ perl -e'$a="a"; $b="bbb"; $a^=$b; $b^=$a; $a^=$b; print "/$a/,/$b/\n +"; print length($a),"\n"; print length($b),"\n"' /bbb/,/a/ 3 3
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: XOR swap bad...
by Jasper (Chaplain) on Mar 25, 2002 at 14:51 UTC | |
by RMGir (Prior) on Mar 25, 2002 at 14:58 UTC |