@KK: Why would XOR method fail when we pass same values of a & b ?? x = 6 y = 6
x = x ^ y; // x ==> 0 y = x ^ y // y ==> 0 ^ 6 ==> 6 x = x ^ y // x ==> 6 ^ 0 ==> 6 So after XORing values of X and Y have been swapped as it is the case normally. On Sat, Jun 11, 2011 at 11:39 PM, KK <[email protected]> wrote: > It wont give correct answer when u pass same values of a and b and > such conditions arises in sorting.... > > > -- > ******************************************* > Kunal Kapadia > Computer Science and Engineering > B.Tech 2nd yr > NIT Trichy > ******************************************* > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
