How Fast Can We Sort?

Computer Science Level pending

The most basic sorting algorithms, such as Bubble Sort, run in O ( n 2 ) O(n^2) time. Some more complicated ones, like Merge Sort, improve dramatically to O ( n log ( n ) ) O(n\log(n)) time. Is it possible to create a sorting algorithm with worst-case runtime O ( n ) ? O(n)?

Bonus: If "yes", can you name one and/or create one? If "no", why not?

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Abhishek Sinha
Oct 9, 2015

If we consider the (binary) results of comparisons performed by any sorting algorithm, it is in one-to-one correspondence with the input string. There are n ! n! possible input strings and hence it would require at least log ( n ! ) = O ( n log n ) \log(n!)= O(n \log n) comparisons for correctly sorting any input string by any sorting algorithm.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...