If you need only the three top elements, then sorting the array of arrays is overkill and will be inefficient if the master array is large. Not good if speed is really important.
I would go for a selection algorithm could be done in two different ways: (1) the simpler (but slower) is to walk through the array once and memorize the array ref of the top element; then walk again through and find the next to top element, and a third time; (2) slightly more complicated is to walk through the array only once and to maintain as you go an auxiliary array of the three top elements; maintaining this auxiliary array is somewhat complicated, but nothing insurmountable.
In reply to Re: sorting array of arrays reference
by Laurent_R
in thread sorting array of arrays reference
by kimlid2810
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |