wavelet_tree_optimized