[Paper Review] A Subquadratic Algorithm for 3XOR
This paper presents a deterministic O(n²) algorithm for the 3XOR problem using a specialized Patricia trie that enables linear-time traversal of a ⊕X for any a, achieving optimal quadratic time. It also introduces a randomized algorithm with expected time O(n² · min{log³w/w, (log log n)²/log²n}) for w = O(n log n), matching the best-known int3SUM bound up to a log w factor, and reduces 3XOR to offline SetDisjointness and SetIntersection to establish conditional lower bounds.
Given a set X of n binary words of equal length w, the 3XOR problem asks for three elements a, b, c in X such that a oplus b=c, where oplus denotes the bitwise XOR operation. The problem can be easily solved on a word RAM with word length w in time O(n^2 log n). Using Han's fast integer sorting algorithm (STOC/J. Algorithms, 2002/2004) this can be reduced to O(n^2 log log n). With randomization or a sophisticated deterministic dictionary construction, creating a hash table for X with constant lookup time leads to an algorithm with (expected) running time O(n^2). At present, seemingly no faster algorithms are known. We present a surprisingly simple deterministic, quadratic time algorithm for 3XOR. Its core is a version of the PATRICIA tree for X, which makes it possible to traverse the set a oplus X in ascending order for arbitrary a in {0, 1}^{w} in linear time. Furthermore, we describe a randomized algorithm for 3XOR with expected running time O(n^2 * min{log^3(w)/w, (log log n)^2/log^2 n}). The algorithm transfers techniques to our setting that were used by Baran, Demaine, and Patrascu (WADS/Algorithmica, 2005/2008) for solving the related int3SUM problem (the same problem with integer addition in place of binary XOR) in expected time o(n^2). As suggested by Jafargholi and Viola (Algorithmica, 2016), linear hash functions are employed. The latter authors also showed that assuming 3XOR needs expected running time n^(2-o(1)) one can prove conditional lower bounds for triangle enumeration just as with 3SUM. We demonstrate that 3XOR can be reduced to other problems as well, treating the examples offline SetDisjointness and offline SetIntersection, which were studied for 3SUM by Kopelowitz, Pettie, and Porat (SODA, 2016).
Motivation & Objective
- To develop a deterministic, subquadratic algorithm for the 3XOR problem, which remains open despite extensive work on 3SUM.
- To adapt techniques from the int3SUM problem, particularly those of Baran, Demaine, and Pâtraşcu, to the 3XOR setting using linear hashing and word-level operations.
- To establish conditional lower bounds for 3XOR by reducing it to offline SetDisjointness and SetIntersection, mirroring reductions used in 3SUM complexity.
- To explore whether structural similarities between 3XOR and 3SUM imply a deeper connection in their optimal time complexities, especially given the absence of Fredman's trick in XOR.
Proposed method
- Construct a word-RAM-compatible Patricia trie for X using only word operations, avoiding bit-level manipulation, enabling O(|X|) traversal of a ⊕X in ascending order for any a ∈{0,1}^w.
- Use linear, 1-universal hash functions to partition X into buckets, enabling efficient randomized search via hashing and bucket intersection checks.
- Apply a multi-level hashing scheme with h2(x) = h21(x) ◦ h22(x), where h21 and h22 are from a 1-universal class, to reduce false positives in the randomized algorithm.
- For offline reductions, create shifted bucket sets X↑_u,v and X↓_u,v using hash values and XOR shifts, then check for non-empty intersections to detect solutions.
- Use multiple hash function choices (Θ(log n) for SetDisjointness) to bound false positive probability polynomially, ensuring correctness with high probability.
- Reconstruct solutions from intersection results and validate them in O(n²) time, ensuring the overall algorithm remains efficient.
Experimental results
Research questions
- RQ1Can a deterministic O(n²) algorithm be achieved for 3XOR using only word-level operations and a specialized Patricia trie structure?
- RQ2Is it possible to achieve a randomized 3XOR algorithm with expected running time close to the best-known int3SUM bound, specifically O(n² · min{log³w/w, (log log n)²/log²n})?
- RQ3Can 3XOR be reduced to offline SetDisjointness and SetIntersection problems in a way that preserves conditional lower bounds, similar to the 3SUM paradigm?
- RQ4Why does Fredman's trick for 3SUM not extend to 3XOR, and what structural differences prevent such a transformation?
Key findings
- A deterministic algorithm for 3XOR runs in O(n²) time by constructing a Patricia trie that supports linear-time traversal of a ⊕X for any a, using only word operations.
- The randomized algorithm achieves expected running time O(n² · min{log³w/w, (log log n)²/log²n}) for w = O(n log n), matching the int3SUM bound up to a log w factor.
- For w > n log n, the algorithm runs in O(n log²n) time, with the crossover point between w and log n dependence at w = (log²n) log log n.
- The paper reduces 3XOR to offline SetDisjointness and SetIntersection, showing that solving 3XOR in o(n²) time would imply subquadratic solutions to these problems.
- The expected number of false positives in the randomized reduction is O(n²−δ), and by sampling Θ(n log n) times, the expected running time remains O(n²−Ω(1)) for the overall algorithm.
- The absence of a Fredman-type identity for XOR (i.e., no linear order preserving a ⊕b ≺c ⊕d ⇔ a ⊕d ≺c ⊕b) suggests a fundamental structural gap between 3XOR and 3SUM, despite their superficial similarity.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.