Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

RE: RE (tilly) 3 (tis true): Randomize an array

by Adam (Vicar)
on Sep 09, 2000 at 00:33 UTC ( #31671=note: print w/replies, xml ) Need Help??

in reply to RE (tilly) 3 (tis true): Randomize an array
in thread Randomize an array

Well..... There is the Radix Sort, which is O(N)... course it also requires more information about what is being sorted, and places constraints on that data set, and well its just not as general so its not considered on par with Qsort or MergeSort.
  • Comment on RE: RE (tilly) 3 (tis true): Randomize an array

Replies are listed 'Best First'.
RE (tilly) 5 (tis true): Randomize an array
by tilly (Archbishop) on Sep 09, 2000 at 00:55 UTC
    Can we really call that O(N)? The constant depends upon the number of passes. As you increase the number of items, eventually you have to have long strings which requires lots of passes, indeed with a fixed number of symbols in your alphabet the number of things you can represent rises exponentially in the length you allow...which means it is truly n*log(n) again. :-)

    Indeed my explanation about Stirling's formula is still relevant, re-read it and you can see that the fundamental issue is that a set of decisions with fixed branching can only account for an exponential number of possibilities. So the number of branches needed to sort n things grows like log(n!) which is order n*log(n). However the big win is that with radix sort you can get a far better branch factor than 2. (At least initially.)

    But unfortunately the radix sort cannot be made to work with arbitrary sort functions since it does not (at least not directly) work off of binary comparisons...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://31671]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2019-05-21 16:31 GMT
Find Nodes?
    Voting Booth?
    Do you enjoy 3D movies?

    Results (135 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!