The fastest sorting

I have tried various sorting algorithms in the last few days. Starting from 1) Algorithms with time sorting O (n ^ 2) 2) O (n log n) time complexity using methods for determining the place and off-site

I am wondering if there is any sorting algorithm that is sorted by linear time or less. I heard about radix sorting, which at best is close to linear time sorting with some spatial complexity. Can someone enlighten me?

+3
source share
4 answers

You can never sort less than O (N), because you need to look at all N elements to determine if the list is sorted - so O (N) is right there. You can also sort faster than O (NlogN) if you sort by comparing with other items in your list, but if you know something about your data, you can. If, for example, you know that your data is English strings, you can put them in buckets before sorting. for example, put all the lines, starting from A in one bucket, from B to another, etc. It will be fast. You may need to make each bucket quite large, although perhaps large enough to fit 1000 lines, since not all buckets will contain the same number of lines.

Then sort the individual buckets that will be fast.

(.. 400 , , , , ), , O (N) + O (Nlog N/M), M - .

, , , , , , . , , , .

, .

+2

- , map/reduce ( )

- , .

, O (n), :

radix:

( )

Radix - O (k · n) n , k . k , radix ( n), , O (n · log (n)). , , k . , ( ) , , k , , log (n), , .

+3

, , , radix . , . Radix , . , , . Page3-6, .

+2

( , )

:

This post compares the performance of the sequential and parallel QuickSort algorithm using a list of integers. Performance is greatly enhanced in a dual-core machine. QuickSort can even run on O (log n) on a system with n processors, according to this article:

http://en.wikipedia.org/wiki/Merge_sort#Parallel_processing

It may seem unrealistic that many cores are available, but with infrastructure as a service (Amazon Cloud, Azure ...), it may be an affordable option for mission-critical implementations.

-2
source

All Articles