Note that most of these methods fail if you try to swap an item with
itself.

For example, swap(a[i], a[j]) will fail if i==j and swap is
implemented as

void swap(int &a, int&b)
{
   a ^= b;
   b ^= a;
   a ^= b;
}

Don

On Nov 4, 3:32 pm, manish <narayan.shiv...@gmail.com> wrote:
> Swapping two objects (not integers/chars),without using temp...?
> my solution is using xor operation..is that right and ny other solutions ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to