When we descend from a node to its child, you need to map positions.
If you're tracking range at a node, and we go left (to elements with bit 0): - New left index: - New right index: Going right (to elements with bit 1): - New left index: - New right index: This mapping is the core of all wavelet tree queries. It tells us which positions in the child correspond to your query range.