Bit Manipulation
Everything on SkillVeris tagged Bit Manipulation — collected across the glossary, study notes, blog, and cheat sheets.
6 resources across 1 library
Interview Questions(6)
N-Queens Problem: How Would You Solve It?
The N-Queens problem is solved with backtracking: place queens column by column, and at each row try every column, only proceeding if the position is not attac…
What is a Fenwick Tree (Binary Indexed Tree)?
A Fenwick tree, or binary indexed tree, is an array-backed structure that answers prefix-sum queries and supports point updates in O(log n) time using O(n) spa…
What Are the Core Bit Manipulation Operators and When Do You Use Them?
Bit manipulation uses the six operators AND (&), OR (|), XOR (^), NOT (~), left shift (<<), and right shift (>>) to inspect, set, clear, or toggle individual b…
How Does the XOR Swap Technique Work, and Should You Actually Use It?
The XOR swap swaps two integer variables without a temporary variable by applying a = a ^ b, then b = a ^ b, then a = a ^ b, exploiting that XOR-ing a value wi…
How Do You Count the Number of Set Bits in an Integer Efficiently?
The fastest general technique counts set bits in O(k) time, where k is the number of set bits, using Brian Kernighan’s trick: repeatedly apply n = n & (n - 1),…
What is a Van Emde Boas Tree and Why Is It So Fast?
A Van Emde Boas (vEB) tree is a data structure over integer keys in a bounded universe of size u that supports insert, delete, search, predecessor, and success…