# Category: Binary

## Circular shift on binary representation of an integer by k positions

Given a positive integer n and k, perform circular shift on binary representation of it by k positions.

## Solve given set of problems without using multiplication or division operators

In this post we will discuss few related problems that can be solved without using multiplication and division operators.

## Reverse Bits of an integer using lookup table

Given an integer, reverse its bits using binary operators and lookup table in O(1) time.

## Find the odd occurring element in log(n) time

Given an array of integers where every element appears even number of times except one element which appears odd number of times, find that odd occurring element in O(log(n)) time and constant space.

## Swap Adjacent Bits of a Number

Given an integer, swap adjacent bits of it. In other words, swap bits present at even positions with those present in odd positions.

## Print all distinct Subsets of a given Set

Given a set S, generate all distinct subsets of it i.e., find distinct power set of set S. A power set of any set S is the set of all subsets of S, including the empty set and S itself.

## Find two odd occurring element in an array without using any extra space

Given an array of integers, duplicates appear in it even number of times except two elements which appears odd number of times. Find both odd appearing element without using any extra memory.

## Swap two bits at given position in an integer

Given an integer, swap two bits at given positions in binary representation of it.

## Add binary representation of two integers

Given two integers, add their binary representation.

## Find odd occurring element in an array in single traversal

Given an array of integers, duplicates are present in it in such a way that all duplicates appear even number of times except one which appears odd number of times. Find that odd appearing element in linear time and without using any extra memory.

## Check if given number is power of 4 or not

Given a number, check if it is power of four or not.

## Check if given number is power of 8 or not

Given a number, check if it is power of 8 or not.