Unicode normalization 2026-11-05
Unicode normalization maps text to a specified standard representation while respecting a chosen equivalence relation between Unicode sequences. Canonical normalization uses canonical equivalence; compatibility normalization additionally uses compatibility equivalence. NFD decomposes canonical combinations, NFC then composes where permitted, and NFKD/NFKC additionally apply compatibility decompositions.[ref]
For example, U+00E9 and U+0065 U+0301 represent canonically equivalent accented text. NFD produces the second sequence from either input, while NFC produces the first. NFKC also changes the circled digit U+2460 to the ordinary digit U+0031; NFC preserves that compatibility distinction. The choice consequently depends on which distinctions an application intends to retain. Unicode normalization is different from choosing a character encoding or a font, and it does not make every visually similar pair of strings equal.
Wavelet tree Created 2026-10-20 Updated 2026-11-05
A wavelet tree stores a sequence over an ordered alphabet by repeatedly splitting the alphabet into two parts. At an internal node, a bit vector records zero or one according to each element's part; the children receive the corresponding stable subsequences. The original wavelet-tree construction uses such relative position encodings to support compact indexed access.[ref]
To answer a rank query for character in the first positions, follow the branch containing . Replace by the number of that branch's bits among the current bit vector's first positions. At the leaf, the resulting is the answer. Stable filtering proves the invariant: it is the number of original-prefix elements reaching the current node.
For example, split as and . The string cadaba gives root bit vector 101000 and left subsequence aaba. In its first five characters there are three left-part elements. The left bit vector 0010 contains two zeros among those first three positions, so the number of a occurrences is two. With constant-time bit rank queries and a balanced alphabet split, character rank queries take time.