Bitwise Algorithms | Basic Last Updated : 26 Sep, 2023 Find the element that appears once Detect if two integers have opposite signs Add 1 to a given number Multiply a given Integer with 3.5 Turn off the rightmost set bit Find whether a given number is a power of 4 or not Compute modulus division by a power-of-2-number Rotate bits of a number Find the Number Occurring Odd Number of Times Check for Integer Overflow Count set bits in an integer Count number of bits to be flipped to convert A to B Efficient way to multiply with 7 Program to find whether a no is power of two Position of rightmost set bit Binary representation of a given number Find position of the only set bit How to swap two numbers without using a temporary variable? Swap two nibbles in a byte How to turn off a particular bit in a number? Russian Peasant (Multiply two numbers using bitwise operators) Add two bit strings Write your own strcmp that ignores cases Check if two numbers are equal without using arithmetic and comparison operators Find XOR of two number without using XOR operator XOR counts of 0s and 1s in binary representation Calculate XOR from 1 to n Equal Sum and XOR Swap three variables without using temporary variable Check if a number has bits in alternate pattern XOR of two numbers after making length of their binary representations equal Count minimum bits to flip such that XOR of A and B equal to C Efficient method for 2’s complement of a binary string Toggle case of a string using Bitwise operators Toggling k-th bit of a number Convert decimal fraction to binary number Toggle all the bits of a number except k-th bit Set the rightmost unset bit Convert a binary number to octal Check in binary array the number represented by a subarray is odd or even Toggle the last m bits 1 to n bit numbers with no consecutive 1s in binary representation Toggle bits in the given range Unset bits in the given range Find the largest number with n set and m unset bits Find the smallest number with n set and m unset bits Sum of numbers with exactly 2 bits set Check if binary representation of a given number and its complement are anagram Check a number is odd or even without modulus operator Bitwise recursive addition of two integers Print bitwise AND set of a number N Fast average of two numbers without division Maximum XOR-value of at-most k-elements from 1 to n Swap every two bits in bytes Check if a number is divisible by 8 using bitwise operators Number of Reflexive Relations on a Set For every set bit of a number toggle bits of other Toggle bits of a number expect first and last bits Check if given four integers (or sides) make rectangle Toggle all even bits of a number Toggle first and last bits of a number Set the Left most unset bit Maximum XOR using K numbers from 1 to n Python | Count set bits in a range Python map function | Count total set bits in all numbers from 1 to n Check whether the bit at given position is set or unset Multiplication with a power of 2 Check if n is divisible by power of 2 without using arithmetic operators Toggle all odd bits of a number Count set bits using Python List comprehension Check if a number is positive, negative or zero using bit operators Modify a bit at a given position CHAR_BIT in C Find One’s Complement of an Integer Add two numbers without using arithmetic operators Multiply a number with 10 without using multiplication operator Check if one of the numbers is one’s complement of the other Check if a number has bits in alternate pattern | Set-2 O(1) Approach Set all the bits in given range of a number Calculate 7n/8 without using division and multiplication operators Count total bits in a number Find most significant set bit of a number Find smallest number n such that n XOR n+1 equals to given k Check if a number has two adjacent set bits Write an Efficient Method to Check if a Number is Multiple of 3 Extract ‘k’ bits from a given position in a number Print ‘K’th least significant bit of a number Check if two numbers are equal without using comparison operators Efficiently check whether n is a multiple of 4 or not Check whether K-th bit is set or not Check if a number is multiple of 9 using bitwise operators Compare two integers without using any Comparison operator Multiplying a variable with a constant without using multiplication operator Check whether a given number is even or odd Powers of 2 to required sum Set all even bits of a number Set all odd bits of a number Print numbers having first and last bits as the only set bits Check if binary representations of two numbers are anagram Multiples of 4 (An Interesting Method) Given a set, find XOR of the XOR’s of all subsets. Write a function that returns 2 for input 1 and returns 1 for 2 Subtract two numbers without using arithmetic operators Quick Links : ‘Practice Problems’ on Bit Magic ‘Quiz’ on Bit Magic ‘Videos’ on Bit Magic If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. Share your thoughts in the comments Add Your Comment Please Login to comment...