Skip to content

Data Structures and Algorithms

Members Public

Solution Review: Get the First Set Bit Position Using the Right Shift

In the kth bit set/unset problem, we first write the algorithm, then some pseudocode, and then implement the solution.

Members Public

Challenge 1: Get the First Set Bit Position Using the Right Shift

This problem is similar to the last lesson we discussed. If you need a clue, return to the previous lesson to further your understanding.

Members Public

Check If Kth Bit Is Set/Unset Using Right Shift

In the kth bit set/unset problem, we need to write a program that checks whether the kth bit of a number is 1 or 0.

Members Public

Solution Review: Get The First Set Bit Position Using the Left Shift

In the kth bit set/unset problem, we first write the algorithm, then some pseudocode, and then implement the solution.

Members Public

Challenge 1: Get the First Set Bit Position Using the Left Shift

This problem is similar to the last lesson we discussed. If you need a clue, return to the previous lesson to further your understanding.

Members Public

Check If Kth Bit Is Set/Unset Using Left Shift

In the kth bit set/unset problem, we need to write a program that checks whether the kth bit of a number is either 1 or 0.

Members Public

Find the Bit Length of a Number

Members Public

Arithmetic and Logical Right Shifts

The logical right shift means shifting the bits to the right, and MSB(most significant bit) becomes 0. The arithmetic right shift means shifting the bits to the right, and MSB is the same as in the original number.

Members Public

Bitwise Left Shifts

The left-shift operator causes the bits in shift-expression to be shifted to the left by the number of positions specified by additive-expression. The bit positions that have been vacated by the shift operation are zero-filled.

Members Public

Introduction to Bit Shifting

A bit shift is a Bitwise operation where the order of a series of bits is moved, either to the left or right, to efficiently perform a mathematical operation.