12-2 Radix trees
Given two strings and , where each and each is in some ordered set of characters, we say that string is lexicographically less than string if either
- there exists an integer , where , such that for all and , or
- and for all .
For example, if and are bit strings, then by rule 1 (letting ) and by rule 2. This ordering is similar to that used in English-language dictionaries.
The radix tree data structure shown in Figure 12.5 stores the bit strings , and . When searching for a key , we go left at a node of depth if and right if . Let be a set of distinct bit strings whose lengths sum to . Show how to use a radix tree to sort lexicographically in time. For the example in Figure 12.5, the output of the sort should be the sequence .
(Removed)