Up to 7 comparisons solving the sorting problem of 5 numbers

Source: Internet
Author: User

This is the last "12 (13) Ball 1 different weight 3 times the detailed analysis" of the sister article, analysis means expatiating, the problem stems from the introduction of the algorithm.

As analyzed above, the 5-digit arrangement has a total of 5!=120 species, the essence of which is to determine one of these 120 permutations, and each comparison will have two results, less than, greater than or equal. 7 Comparisons Total 27 = 128 results, it is possible to distinguish 120 kinds of permutations with up to 128 comparison results. The solution is filled with a lot of permutations and combinations to calculate the number of possibilities to distinguish between the various options, which may not be easy to calculate. Always keep in mind that the lower bound of information theory is used to eliminate the possibility, but the information theory lower bound can only be excluded, but cannot be affirmed.

  

Use a circle and a fork to represent the number, if there is a connection between two numbers, the number above the line is greater than or equal to the number below the line.

Each step of the two forks represents the two numbers that this step selects to compare.

When 5 numbers are strung together with a line, the sort ends, of course.

There may be many situations in the same row that I have marked out.

Up to 7 comparisons solving the sorting problem of 5 numbers

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.