Packed Bit-Width Anagram Hashing: A Constant-Time Comparison Algorithm for Anagram Equivalence

Read full text
Authors: Nicholas David Brown
Cited by: 3

Abstract

An improved algorithm for anagram grouping that achieves O(1) comparison cost — a 26x speedup over count arrays and nx speedup over sorted strings — with 6-13x storage reduction. By pre-computing per-letter bit-widths from corpus constraints and packing letter frequencies into minimal register space, the method enables single-instruction equality testing. The paper also describes a structured tree organization of anagram-space that enables range and near-anagram queries not possible with current hash table approaches. Includes complete reference implementation in Python.

Fields of Study & Subjects

Algorithms and Data Compression Advanced Database Systems and Queries Data Management and Algorithms

Publication details

Journal / source
Zenodo (CERN European Organization for Nuclear Research)
Publication date
7 January 2026
Document type
Preprint