3 ms·
The really nasty edge case is aliasing. Say you're swapping a[i] with a[j]. What happens when i==j? Nope, not what any sane person expects a swap operation to d
by praptak 14y ago
The really nasty edge case is aliasing. Say you're swapping a[i] with a[j]. What happens when i==j? Nope, not what any sane person expects a swap operation to do in this case...
This nasty trick was actually used in one of the Underhanded C Contest entries in 2007.