Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Bitten by the worst case (or why it pays to know whats inside the black box)

by thor (Priest)
on Jun 26, 2004 at 14:12 UTC ( [id://369828]=note: print w/replies, xml ) Need Help??


in reply to Bitten by the worst case (or why it pays to know whats inside the black box)

The only observation that I have is that if I were a maintenance programmer and say the shuffle in there, I'd say "WTF?" I'm not saying that it's the wrong thing to do, it's just counterintuitive to shuffle an array before sorting it.

thor

  • Comment on Re: Bitten by the worst case (or why it pays to know whats inside the black box)

Replies are listed 'Best First'.
Re^2: Bitten by the worst case (or why it pays to know whats inside the black box)
by demerphq (Chancellor) on Jun 26, 2004 at 14:23 UTC

    it's just counterintuitive to shuffle an array before sorting it.

    And yet this is what many quicksort implementations do by default in order to avoid the worst case. But you are correct, Ill add a comment explaining the purpose of the shuffle so that it doesnt cause any confusion later on. Thanx for suggestion.


    ---
    demerphq

      First they ignore you, then they laugh at you, then they fight you, then you win.
      -- Gandhi


Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-26 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found