AND (&) operator : It takes 2 operands as input and does AND operation on each and every bit of the input and provides us the output.
OR ( | ) operator : It takes 2 operands as input and does OR operation on each and every bit of the input and provides us the output.
XOR (^) operator : It takes 2 operands as input and does XOR operation on each and every bit of the input and provides us the output.
NOT(~) operator : It takes 1 operand as input and does NOT operation on the input and provides us the output.
Bit-wise XOR operations is one of the important operations which can be used for various kinds of problems.
For XOR, 1^1 = 0, 1^0=1:
i.e. XOR on same bit becomes 0 and with different bit becomes 1.
The same concept can be used in many factors that
5^5=0,
3^0=3
2^3^2=3
7^4^2^8^2^4^8=7
so we can exploit the concepts here that in a series of XOR operations, XOR of pairs of numbers becomes 0. This can be helpful in identifying odd no of occurrence of data.
OR ( | ) operator : It takes 2 operands as input and does OR operation on each and every bit of the input and provides us the output.
XOR (^) operator : It takes 2 operands as input and does XOR operation on each and every bit of the input and provides us the output.
NOT(~) operator : It takes 1 operand as input and does NOT operation on the input and provides us the output.
Bit-wise XOR operations is one of the important operations which can be used for various kinds of problems.
For XOR, 1^1 = 0, 1^0=1:
i.e. XOR on same bit becomes 0 and with different bit becomes 1.
The same concept can be used in many factors that
5^5=0,
3^0=3
2^3^2=3
7^4^2^8^2^4^8=7
so we can exploit the concepts here that in a series of XOR operations, XOR of pairs of numbers becomes 0. This can be helpful in identifying odd no of occurrence of data.
No comments:
Post a Comment