as if the shorter keys were left-justified and padded on the right with blank characters to make the shorter keys as long as the longest key. MSD sorts are not necessarily stable if the original ordering of duplicate keys must always be maintained. Other than the traversal order, MSD and LSD sorts differ in their handling of variable length input. LSD sorts can group by length, radix sort each group, then concatenate the groups in size order. MSD sorts must effectively 'extend' all shorter keys to the size of the largest key and sort them accordingly, which can be more complicated than the grouping required by LSD. However, MSD sorts are more amenable to subdivision and recursion. Each bucket created by an MSD step can itself be radix sorted using the next most significant digit, without reference to any other buckets created in the previous step. Once the last digit is reached, concatenating the buckets is all that is required to complete the sort. Examples Least significant digit Input list: [170, 45, 75, 90, 2, 802, 2, 66] Starting from the rightmost (last) digit, sort the numbers based on that digit: [{170, 90}, {2, 802, 2}, {45, 75}, {66}] Sorting by the next left digit: [{02, 802, 02}, {45}, {66}, {170, 75}, {90}] Notice that an implicit digit 0 is prepended for the two 2s so that 802 maintains its position between them. And finally by the leftmost digit: [{002, 002, 045, 066, 075, 090}, {170}, {802}] Notice that a 0 is prepended to all of the 1- or 2-digit numbers. Each step requires just a single pass over the data, since each item can be placed in its bucket without comparison with any other element. Some radix sort implementations allocate space for buckets by first counting the number of keys that belong in each bucket before moving keys into those buckets. The number of times that each digit occurs is stored in an array. Although it is always possible to pre-determine the bucket boundaries using counts, some implementations opt to use dynamic memory allocation instead. Most significant digit, forward recursive Input list, fixed width numeric strings with leading zeros: [170, 045, 075, 025, 002, 024, 802, 066] First digit, with brackets indicating buckets: [{045, 075, 025, 002, 024, 066}, {170}, {802}] Notice that 170 and 802 are already complete because they are all that remain in their buckets, so