Shashwat Kasliwal ; Adam Polak ; Pratyush Sharma - 3SUM in Preprocessed Universes: Faster and Simpler

theoretics:14907 - TheoretiCS, October 16, 2025, Volume 4 - https://doi.org/10.46298/theoretics.25.24
3SUM in Preprocessed Universes: Faster and SimplerArticle

Authors: Shashwat Kasliwal ; Adam Polak ORCID; Pratyush Sharma

    We revisit the 3SUM problem in the \emph{preprocessed universes} setting. We present an algorithm that, given three sets $A$, $B$, $C$ of $n$ integers, preprocesses them in quadratic time, so that given any subsets $A' \subseteq A$, $B' \subseteq B$, $C' \subseteq C$, it can decide if there exist $a \in A'$, $b \in B'$, $c \in C'$ with $a+b=c$ in time $O(n^{1.5} \log n)$.
    In contrast to both the first subquadratic $\tilde{O}(n^{13/7})$-time algorithm by Chan and Lewenstein (STOC 2015) and the current fastest $\tilde{O}(n^{11/6})$-time algorithm by Chan, Vassilevska Williams, and Xu (STOC 2023), which are based on the Balog--Szemerédi--Gowers theorem from additive combinatorics, our algorithm uses only standard 3SUM-related techniques, namely FFT and linear hashing modulo a prime. It is therefore not only faster but also simpler.
    Just as the two previous algorithms, ours not only decides if there is a single 3SUM solution but it actually determines for each $c \in C'$ if there is a solution containing it. We also modify the algorithm to still work in the scenario where the set $C$ is unknown at the time of preprocessing. Finally, even though the simplest version of our algorithm is randomized, we show how to make it deterministic losing only polylogarithmic factors in the running time.

    12 pages. This is the TheoretiCS journal version (invited article from SOSA 2025)


    Volume: Volume 4
    Published on: October 16, 2025
    Accepted on: August 11, 2025
    Submitted on: December 6, 2024
    Keywords: Data Structures and Algorithms