Geeks With Blogs
Abhishek Anand Bits & Bytes about .net technology framework.
Maintainable SolutionEfficient Solution
void swap(ref int x, ref int y)
{
  int temp = x;
  x= y;
  y = temp;
}
void swap(ref int x, ref int y)
{
  x = x ^ y; //Bit-wise XOR
  y = y ^ x; //Bit-wise XOR
  x = x ^ y; //Bit-wise XOR
}

Posted on Monday, October 21, 2013 2:02 PM .net , programming | Back to top


Comments on this post: Efficiency vs. Readability

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Abhishek Anand | Powered by: GeeksWithBlogs.net