A gothic algorithm for efficiently sorting arrays by any index if you don't already have a sort function that can take an arbitrary comparison function as an argument.