Fast Wavelet Tree Construction in Practice

Author: Yusaku Kaneta


The wavelet tree is a compact data structure that supports various types of operations on a sequence of n integers in [0,𝜎) . Although Munro et al. (SPIRE 2014 and Theoretical Computer Science 2016) and Babenko et al. (SODA 2015) showed that wavelet trees can be constructed in 𝑂(𝑛⌈lg𝜎/lg𝑛‾‾‾‾√⌉) time, there has been no empirical study on their construction methods possibly due to its heavy use of precomputed tables, seemingly limiting its practicality. In this paper, we propose practical variants of their methods. Instead of using huge precomputed tables, we introduce new techniques based on broadword programming and special CPU instructions available for modern processors. Experiments on real-world texts demonstrated that our proposed methods were up to 2.2 and 4.5 times as fast as the naive ones for the wavelet tree and the wavelet matrix (a variant of wavelet trees), respectively, and up to 1.9 times as fast as a state of the art for the wavelet matrix.

Copied! instagram
Research Areas : #Others
Careers : Open Positions