Huffman-Bucket Sketch: A Simple $O(m)$ Algorithm for Cardinality Estimation

Fuente: arXiv
Saved in:
Bibliographic Details
Main Author: Karppa, Matti
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866908879403614208
author Karppa, Matti
author_facet Karppa, Matti
contents We introduce the Huffman-Bucket Sketch (HBS), a simple, mergeable data structure that losslessly compresses a HyperLogLog (HLL) sketch with $m$ registers to optimal space $O(m+\log n)$ bits, with amortized constant-time updates, acting as a drop-in replacement for HLL that retains mergeability and substantially reduces memory requirements. We partition registers into small buckets and encode their values with a global Huffman codebook derived from the strongly concentrated HLL rank distribution, using the current cardinality estimate for determining the mode of the distribution. We prove that the Huffman tree needs rebuilding only $O(\log n)$ times over a stream, roughly when cardinality doubles. The framework can be extended to other sketches with similar strongly concentrated distributions. We provide preliminary numerical evidence that suggests that HBS is practical and can potentially be competitive with state-of-the-art in practice.
format Preprint
id arxiv_https___arxiv_org_abs_2603_10930
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Huffman-Bucket Sketch: A Simple $O(m)$ Algorithm for Cardinality Estimation
Karppa, Matti
Data Structures and Algorithms
68W20, 94A45, 68P05, 68P30
G.3; E.4
We introduce the Huffman-Bucket Sketch (HBS), a simple, mergeable data structure that losslessly compresses a HyperLogLog (HLL) sketch with $m$ registers to optimal space $O(m+\log n)$ bits, with amortized constant-time updates, acting as a drop-in replacement for HLL that retains mergeability and substantially reduces memory requirements. We partition registers into small buckets and encode their values with a global Huffman codebook derived from the strongly concentrated HLL rank distribution, using the current cardinality estimate for determining the mode of the distribution. We prove that the Huffman tree needs rebuilding only $O(\log n)$ times over a stream, roughly when cardinality doubles. The framework can be extended to other sketches with similar strongly concentrated distributions. We provide preliminary numerical evidence that suggests that HBS is practical and can potentially be competitive with state-of-the-art in practice.
title Huffman-Bucket Sketch: A Simple $O(m)$ Algorithm for Cardinality Estimation
topic Data Structures and Algorithms
68W20, 94A45, 68P05, 68P30
G.3; E.4
url https://arxiv.org/abs/2603.10930