×
Home Discussions Write at Opengenus IQ
×
  • About
  • Track your progress
  • Deep Learning Projects
  • Python Projects
  • Join our Internship 🎓
  • RANDOM
  • 100+ Graph Algorithms
  • 100+ DP Problems
  • 50+ Linked List Problems
  • 50+ Array Problems
  • One Liner
  • 50+ Binary Tree problems
  • Home
  • Rust Projects

bitwise algorithm

A collection of 19 posts

bitwise algorithm

Find the rightmost set bit in a number (+ toggle it)

Finding the rightmost set bit in a number is a common problem in computer science and is used in many applications, from competitive programming to low-level programming and data compression. In this article, we will explore various techniques to find the rightmost set bit in a number.

S Sudharshan
Algorithms

Nearest smaller and greater numbers with same number of set bits

In this article, we shall explore the various ways we can find the Nearest smaller and greater numbers with same number of set bits for given number.

J. Varun Iyer J. Varun Iyer
Algorithms

Find smallest of 3 integers without comparison

In this guide, we will go through how to get the smallest of three numbers without using Comparison operation. We have presented 3 different techniques using decrement, division and shift operation.

Harshita Singh Harshita Singh
Algorithms

Absolute value of Integer using Bitwise Operations

In this article, we have explained two approaches to find the Absolute value of Integer using Bitwise Operations namely Right shift, OR and XOR operations.

Shubhankar Maurya Shubhankar Maurya
Algorithms

Swap two bits in a number

In this problem, we have to swap bits in a given number or an integer. This can be solved in constant time O(1) using XOR operation.

Shwet Shukla Shwet Shukla
Algorithms

Rotate Image: matrix of size NxN by 90 degrees (clockwise)

In this article, we have explored an efficient way to Rotate Image: matrix of size NxN by 90 degrees (clockwise) inplace by using a property of XOR operation.

Katia Kaori Kaminishikwahara Katia Kaori Kaminishikwahara
Algorithms

Applications of XOR operation

We will begin with a brief introduction of what the XOR operation is, followed by its syntax in C++ and its applications such as memory-optimized doubly linked lists, swapping, XOR ciphers, Comparing two values, Gray codes and Partiy check.

J. Varun Iyer J. Varun Iyer
Algorithms

Swap 2 variables [6+ techniques]

We have explored about Swapping of 2 variables. We have presented different methods to do so including swapping using third variable, using arithmetic operations, XOR, macro and much more along with their pros and cons.

Satvik Singh
Algorithms

Multiplication using bitwise operations

We have explained how to compute Multiplication using Bitwise Operations. We can solve this using left shift, right shift and negation bitwise operations.

Vikram Shishupalsingh Bais Vikram Shishupalsingh Bais
Algorithms

Brian Kernighan's Algorithm

In this article, we will learn what are set bits and how to count them. And we will also learn about Brian Kernighan's algorithm a famous algorithm to find the number of set bits in a number.

Adith Narein T Adith Narein T
Algorithms

Division using Bitwise Operations

We will see how to divide a number using the bitwise operator >> rather than using the regular division operator / or the multiplication operator * or the modulo operator %.

Adith Narein T Adith Narein T
Algorithms

Comparison using bitwise operations

We have explored the idea of making comparisons (equal, larger, smaller) through bitwise operations along with the basic idea of bitwise operations and their examples.

Vansh Pratap Singh Vansh Pratap Singh
Algorithms

Maximum XOR of two numbers in an array using Trie

Given a list of numbers we need to identify a pair of numbers in the list such that the XOR of those numbers is the maximum possible over all the pairs.

Rohit Topi
Algorithms

Travelling Salesman Problem (Bitmasking and Dynamic Programming)

In this article, we will start our discussion by understanding the problem statement of The Travelling Salesman Problem perfectly and then go through the basic understanding of bit masking and dynamic programming.

Abhijit Tripathy Abhijit Tripathy
Algorithms

Minimum Bitwise OR operations to make any two array elements equal

Given an array of integers and an integer K, we can perform the Bitwise OR operation between K and elements of the array any number of times. We have to count minimum number of such operations that are required to make any two elements of the array equal.

Ishaan Ahuja
Algorithms

Counting number of set bits (1) in a number (Brian Kernighan Algorithm)

With this article at OpenGenus, you must have the complete idea of Counting the number of set bits (1) in a number using naive approach and Brian Kernighan Algorithm.

Aayushi Ghadiya
Algorithms

String Matching using Bitset

In this article, we have explored how to solve string matching problem (find all occurences of string S1 in another string S2) using Bitset. It is a modification of the naive approach which takes O(L x P x logL) time complexity which improves to O(L x P / K) using bitset.

Anand Saminathan
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
OpenGenus IQ © 2023 All rights reserved â„¢ [email: team@opengenus.org]
Top Posts LinkedIn Twitter