Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Sort problems

by pobocks (Chaplain)
on Dec 02, 2008 at 10:39 UTC ( [id://727358]=note: print w/replies, xml ) Need Help??


in reply to Sort problems

How, with this many solutions, did I immediately gravitate toward the stupidest?

My plan was to make a copy of the list, and then pad out all the numbers with leading zeroes to make them compare naturally under regular alphebetization.

I felt that it was a stupid plan the moment it came up, but the stupidest? Woe is me...

for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";

Replies are listed 'Best First'.
Re^2: Sort problems
by AnomalousMonk (Archbishop) on Dec 02, 2008 at 13:07 UTC
    Your "stupid plan" is the heart of the Guttman-Rosler Transform (GRT; see Advanced Sorting - GRT - Guttman Rosler Transform). This approach is based on the fact that using the default lexicographic sorting of sort is faster than using a sort subroutine block, so multi-key GRT sorts will tend to outstrip ST sorts as the array size grows beyond some threshold.

    Just think, if you had come up with this stupid idea a few years ago, your own name might now be immortalized in the annals of Perl!

    The original paper is A Fresh Look at Efficient Perl Sorting, also linked by demerphq's link above.

      Just think, if you had come up with this stupid idea a few years ago, your own name might now be immortalized in the annals of Perl!

      Maybe, but I'd say not likely. As it happened, the technique was named for the two fellows who extensively analyzed it and wrote a paper about it, but not for the guy who first (as far as can be discerned from the Historical Records) came up with the idea, Michal Rutka. Here's the Usenet message.

      Between the mind which plans and the hands which build, there must be a mediator... and this mediator must be the heart.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-23 13:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found