Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: sorting array of arrays reference

by salva (Monsignor)
on Oct 26, 2013 at 16:46 UTC ( #1059824=note: print w/ replies, xml ) Need Help??


in reply to sorting array of arrays reference

A concise O(N) solution:

my @top = @masterArray[0..2]; @top = (sort { $b->[2] <=> $a->[2] } @top, $masterArray[$_])[0..2] for + 3..$#masterArray;
Though, I have no idea how fast it would be.


Comment on Re: sorting array of arrays reference
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2014-07-29 19:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (226 votes), past polls