suppose if we want to swap 3 and 5

*a=3
*b=5
then,
1st xoring  *a and *b and copying back to *a   *a=011
                                                                   *b=101

------------
                                                                    *a=110

2nd--> *b^=^a  ---> *b=101
                            *a=110
                            -----------
                             *b=011 (i.e *a) .....if we implement next step
both are swapped!

hope its clear!

-- 
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