Can the sorting algorithm actually break the Nlog (n) time complexity?

Source: Internet
Author: User

Today in the brush algorithm unexpected discovery sorting algorithm by binary search improvement can get log2 (n!) of time complexity.

Let's look at a graph of the complexity of each time.

This is a graphic drawn using Desmos. The main comparisons are xlog (x), x^2, log (x!), log (x), and x graphics.

and a bigger picture.

Compare log (x!) with graphs Lower than Xlog (x) is higher than x, but usually our sorting algorithm is optimized for fast and merge Xlog (x) The worst is n^2, by binary finding the improved sorting algorithm is the worst log (n!), preferably N.

Although Nlog (n) and log (n!) The difference is not particularly large, we can see when x=120 log (n!) Compared to Nlog (n) can be increased by 25%, I also think such a high efficiency of the sequencing I am so stupid to come out, online you should have already known Daniel. It does not appear on the Internet (the occurrence rate is too low) is also a reason, only when the use of linked list storage to achieve the time complexity is log (n!), if the use of arrays, due to array insertion and dynamic expansion of the time-consuming complexity is n^2,,,, next write implementation

Can the sorting algorithm actually break the Nlog (n) time complexity?

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.