Skip to main content

XOR Basis

Learn XOR Basis (Bit Manipulation, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

What an XOR Basis Represents Numbers form a vector space over GF(2) under XOR. An XOR BASIS is a minimal set of numbers such that every XOR combination of ANY subset of the original array can be reproduced by XOR-ing some subset of the basis. Building it lets you answer questions like "what is the maximum possible XOR of any subset?" without checking all 2ⁿ subsets.

More lessons in Bit Manipulation