
Bit Manipulation


Computing Parity of a Number

Detecting If Two Integers have Opposite Signs or Not
Find the Position of the Rightmost Set Bit
Learn how to find the position of the rightmost set bit in a binary number using C++. Includes two e...

Check if a Positive Integer is a power of 2 Without Using any Branching or Loop
Check if a number is a power of 2 using efficient C++ methods like bitwise AND, set bit count, and d...
Toggling the K'th Bit
Learn how to toggle the k-th bit of an integer in C++ using bitwise XOR. Efficient and easy method t...
Checking If the k'th Bit is Set in a Number
Learn how to check if the k'th bit is set in an integer using efficient bitwise operations in C++. I...
Turn On k'th Bit in a Number
Learn how to set the k-th bit of an integer using bitwise operations in C++. Efficient, beginner-fri...
Turn Off (Clear) k'th Bit in a Number
Learn how to clear (set to 0) the k-th bit in an integer using efficient bitwise operations in C++....
Swap Two Numbers Without Using Any Third Variable
Swap two numbers without using a third variable using XOR or arithmetic operations. Learn efficient...
Check If an Integer is Even or Odd
Learn how to check if a number is even or odd in C++ using the modulus operator and bitwise AND meth...
