Tutorialspoint.dev

Introduction To

Bitwise Algorithms

Bitwise Algorithms are Algorithms used to perform operations at bit-level or to manipulate bits in different ways. The bitwise operations are found to be much faster and are some times used to improve the efficiency of a program.

For example: To check if a number is even or odd. This can be easily done by using Bitwise-AND(&) operator. If the last bit of the operator is set than it is ODD otherwise it is EVEN. Therefore, if num & 1 not equals to zero than num is ODD otherwise it is EVEN.

Operations with bits are used in Data compression (data is compressed by converting it from one representation to another, to reduce the space)  In order to encode, decode or compress files we have to extract the data at bit level. Bitwise Operations are faster and closer to the system and sometimes optimize the program to a good level.

 

Course Structure

Subscribe to Our Newsletter