Couriers also use the LSD Algorithm

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.