a pretty simple implementation of a wavelet tree