![]() |
|
Think about Loose Coupling | |
PerlMonks |
sorting questionby chinman (Monk) |
on Oct 17, 2004 at 19:29 UTC ( [id://399954]=perlquestion: print w/replies, xml ) | Need Help?? |
chinman has asked for the wisdom of the Perl Monks concerning the following question:
Brethren,
I have a reference to a 2-D array ($xy) of floats. I would like to sort the y values (in descending order), but ideally I would like the x values to follow the sorting of y. One implementation that I came up with uses a hash as shown below to make a new array of x values that follows the y sort, but I'm sure there's a more efficient way to do this. My 2-D array can be pretty large (10k - 100k data points), so I'm interested in speed. Thanks for your suggestions.
Regards chinman
Back to
Seekers of Perl Wisdom
|
|