Wavelet trees: From theory to practice