whoashish's cp notes

Home

❯

6. Bit Manipulation

6. Bit Manipulation

Oct 08, 20261 min read

  • i. Bit Tricks and XOR: Bitwise operations act on every bit independently, with no carries.
  • ii. Gray Code: An ordering of all 2n bit strings where consecutive strings differ in exactly one bit.
  • iii. Submasks, Supermasks and SOS DP: Iterating over subsets of subsets costs 3n.
  • iv. Bitwise Convolutions: XOR, AND and OR convolutions on arrays of size 2n all follow the same recipe as FFT:
  • v. XOR Basis: Integers are vectors over F2​ and XOR is vector addition.
  • vi. Bitset: Pack 64 booleans into a machine word and operate on all of them at once.
  • vii. Bitset and Word-Level Parallelism: A machine word holds w=64 booleans, and one instruction processes all of them.

7 items under this folder.

  • Oct 08, 2026

    i. Bit Tricks and XOR

    • bits
    • xor
  • Oct 08, 2026

    ii. Gray Code

    • bits
    • gray-code
  • Oct 08, 2026

    iii. Submasks, Supermasks and SOS DP

    • bits
    • sos-dp
    • bitmask
  • Oct 08, 2026

    iv. Bitwise Convolutions

    • bits
    • fwht
    • convolution
  • Oct 08, 2026

    v. XOR Basis

    • bits
    • linear-algebra
    • xor
  • Oct 08, 2026

    vi. Bitset

    • bits
    • bitset
    • optimization
  • Oct 08, 2026

    vii. Bitset and Word-Level Parallelism

    • optimization
    • bitset