[Algo] [July] algorithm based on comparison ordering the lower bound is O (NLOGN)

Source: Internet
Author: User

Suppose: There are n numbers that need to be sorted.

The full arrangement of n numbers is a (n,n) = n!

Based on comparison, I<j. in the best case , you can sift half of the n! possible. That is to say, the remaining (N!/2) species is possible.

This comparison is done in K-times. Finally sift out a sort (conforming to the requirements):

n!/(2k) < 1

Formula derivation:

2k > n! I understand that k means how many times to sift, 2k is the possibility of permutation. Then the 2k is larger than n! to ensure that the sieve contains the correct arrangement.

Klog (2) > log (n!) Take the logarithm on both sides

K > Log (n!) Ignore constants

N!<nn = log (n!) ~nlog (N)

Push to:

K > Nlog (N)//So Nlog (n) is the Nether

  

[Algo] [July] algorithm based on comparison ordering the lower bound is O (NLOGN)

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.