Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

by Adam (Vicar)
on Sep 09, 2000 at 00:33 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-23 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found