View LSD base sorting todayAlgorithmThis algorithm sorts the expressions of a number (2 as the base) or a string (128 or 256 or 10 as the base) from right to left, finally, an ordered sequence is obtained. However, you must use a stable sorting algorithm. Otherwise, the correct result cannot be obtained.
For example, the sequence with sorting is as follows:
13772068889
13772068878
13772066880
13772068883
13772068882
When using the LSD sorting algorithm, select the base number as 10. First, sort the corresponding string using the key-value index Sorting Algorithm Based on the rightmost digit, sort the last and second digits in a similar way, and so on. Finally, the leftmost digits in the sorting order are sorted to get an ordered sequence.
Each time I go to Shentong for express delivery, the courier first asks me the tail number of the mobile phone, and then quickly finds out my stuff from many heaps of goods. It is estimated that he should sort the tail number of the mobile phone similar to LSD, put the same tail number in a pile. When the customer reports the mobile phone number, they will go to the corresponding pile to find the goods, which greatly improves the search speed. Ah, there is great wisdom in small express delivery.