×
Home Discussions Write at Opengenus IQ
×
  • DSA Cheatsheet
  • HOME
  • Track your progress
  • Deep Learning (FREE)
  • Join our Internship 🎓
  • RANDOM
  • One Liner

bitwise operation

A collection of 13 posts

C++

Set, clear and toggle a bit in C++ [4 different methods]

In this article, we will discuss about how to Set a bit, Clear a bit, and Toggle a bit of an integer in C++.

Md. Reyanus Salehin
Algorithms

Subtraction using bitwise operations

We are going to take a look at how can we subtract two numbers without using arithmetic operation. We will only use bitwise operations to perform subtraction.

Nitin Sharma Nitin Sharma
Algorithms

Addition using Bitwise Operations

In this article, we will see how to add any two positive numbers using the bitwise operators like and, xor, and left shift operators rather than using the normal addition operator (+).

Adith Narein T Adith Narein T
Data Structures

Understanding Bit mask/ Bit map in depth

A bit mask is a data structure, usually an integer or array of bits, that represent a bit pattern which signifies a particular state in a particular computational problem. It takes advantage of bitwise operations.

Ajay Bechara Ajay Bechara
bitwise operation

Algorithm to detect whether two numbers have opposite signs using bitwise operators

We present a bitwise algorithm to detect whether two numbers have opposite signs. This is important as using comparision based operations is slow and nearly all hardware support optimizations for bitwise operations

Ashish singh Ashish singh
bitwise operation

Bitwise Algorithm to Find the Number Occurring with Odd Frequency

We have explored the bitwise algorithm to find the only number occuring odd number of times in a given set of numbers. We have used the XOR operator to solve this problem in O(N) time complexity in contrast to the native algorithm which takes O(N^2) time complexity. The space complexity is constant.

Piyush Mishra
bitwise operation

Maximise XOR of a given integer with a number from the given range

Given q queries each of specifies three integers x, l, r. We have to find an integer from given range [l, r] inclusive, such that it gives maximum XOR with x. All values are assumed to be positive. We will show two ways to solve this interesting problem.

Aman Agarwal Aman Agarwal
bitwise operation

Detect if a number is power of 4 using bitwise operators

Reading time: 15 minutes | Coding time: 2 minutes Algorithm Implementation Complexity Questions Bitwise operators are one of the most under-rated operators in C/C++, despite being quite fast as most of the processors

Pratik Jain
bitwise operation

Check if Two Numbers are Equal using Bitwise Operators

Bitwise Operators Explanation Implementations Applications Reading time: 15 minutes | Coding time: 2 minutes In this article, we will explore the technique of checking whether two numbers are equal using bitwise operators. Bitwise operator

Ronit Ray Ronit Ray
bitwise operation

Detect if a number is power of 2 using bitwise operators

Reading time: 15 minutes | Coding time: 1 minutes Algorithm Implementation Complexity Questions Bitwise operators are one of the most under-rated operators in C/C++, despite being quite fast as most of the processors

OpenGenus Tech Review Team OpenGenus Tech Review Team
bitwise operation

Basic Bitwise Operations: AND, OR, XOR, NOT, LEFT and RIGHT SHIFT

Reading time: 15 minutes Bitwise AND (&) Bitwise OR (|) Bitwise XOR (^) Bitwise Unary NOT (~) Left Shift ( Right Shift (>>) It is a well-known fact that computers do not interpret numbers and other data like we

OpenGenus Tech Review Team OpenGenus Tech Review Team
bitwise operation

Left and Right Bit Rotation using Bitwise Operators

Left Rotation Right Rotation Pseudocode Implementation Applications Question Reading time: minutes | Coding time: minutes A bitwise operation involves manipulation of one or more bits of a bit pattern. A bitwise operation can simply

Saptarshi De
game theory

Exploring The Game of Nim

Nim is a mathematical game of strategy in which two players take turns removing objects from distinct heaps. The key to the theory of the game is the binary digital sum of the heap sizes "exclusive or" (xor). It is called the nim-sum. Find implementations of winning strategy and applications

Uddeshya Singh Uddeshya Singh
OpenGenus IQ © 2025 All rights reserved â„¢
Contact - Email: team@opengenus.org
Primary Address: JR Shinjuku Miraina Tower, Tokyo, Shinjuku 160-0022, JP
Office #2: Commercial Complex D4, Delhi, Delhi 110017, IN
Top Posts LinkedIn Twitter
Android App
Apply for Internship