Created
March 6, 2017 12:32
-
-
Save TilakMaddy/87af1542162daed9792370decde8e3fd to your computer and use it in GitHub Desktop.
XOR swapping algorithm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When you got two numbers ` a = 9 ` and ` b = 7 ` | |
On performing | |
a ^= b | |
b ^= a | |
a ^= b | |
a abd b interchange values hence | |
print(a) // 7 | |
print(b) // 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment