Get the latest tech news

Compact Fenwick trees for dynamic ranking and selection (2019)


The Fenwick tree is a classical implicit data structure that stores an array in such a way that modifying an element, accessing an element, computing a prefix sum and performing a predecessor search on prefix sums all take logarithmic time. We introduce a number of variants which improve the classical implementation of the tree: in particular, we can reduce its size when an upper bound on the array element is known, and we can perform much faster predecessor searches. Our aim is to use our variants to implement an efficient dynamic bit vector: our structure is able to perform updates, ranking and selection in logarithmic time, with a space overhead in the order of a few percents, outperforming existing data structures with the same purpose. Along the way, we highlight the pernicious interplay between the arithmetic behind the Fenwick tree and the structure of current CPU caches, suggesting simple solutions that improve performance significantly.

View a PDF of the paper titled Compact Fenwick trees for dynamic ranking and selection, by Stefano Marchini and 1 other authors We introduce a number of variants which improve the classical implementation of the tree: in particular, we can reduce its size when an upper bound on the array element is known, and we can perform much faster predecessor searches. Along the way, we highlight the pernicious interplay between the arithmetic behind the Fenwick tree and the structure of current CPU caches, suggesting simple solutions that improve performance significantly.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Selection

Selection

Photo of Compact Fenwick

Compact Fenwick

Photo of dynamic ranking

dynamic ranking

Related news:

News photo

Evaluating faithfulness and content selection of LLMs in book-length summaries

News photo

Fujitsu set to be preferred bidder in UK digital ID scheme - Selection comes despite Japanese supplier's role in Post Office scandal

News photo

How to build a white gaming PC 2024: part selection, deal-finding and more