While I don't care for the idea of using sort for this, if you are going to use it, doing it like you did and avoiding the ST probably makes a lot of sense. It should take less memory, not more. And, since length() is very fast it probably won't lose by much on performance either (it might even win.) And, you just can't beat the clarity of the code.
-sauoq "My two cents aren't worth a dime.";
In reply to Re^4: Finding the Shortest Element in an Array
by sauoq
in thread Finding the Shortest Element in an Array
by awohld
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |