4. Flipping a specific bit #
Created Monday 29 June 2020
- Flipping a single bit, negation.
- Flipping a bit at a position.
e.g 111011, i = 2 We can XOR this with 000100. This is 2^i
n^=(1<<i); // flip ith bit O(1)
Created Monday 29 June 2020
e.g 111011, i = 2 We can XOR this with 000100. This is 2^i
n^=(1<<i); // flip ith bit O(1)