Re: Sorting a list of pairs on the second elements

*To*: mathgroup at smc.vnet.net*Subject*: [mg51383] Re: Sorting a list of pairs on the second elements*From*: koopman at sfu.ca (Ray Koopman)*Date*: Fri, 15 Oct 2004 02:47:59 -0400 (EDT)*References*: <cklmi7$f1o$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

János <janos.lobb at yale.edu> wrote in message news:<cklmi7$f1o$1 at smc.vnet.net>... > [...] > In general, if I have a list whose elements are m-member lists, like > {{a1,...,am},...,{z1,...,zm}}, then my question is what is the > best/fastest way to sort it on the k-th elements of the members where > 1<=k<=m and ak,...,zk are arbitrary objects - in my case Strings - and > use as little memory for it as possible. > Sort[list, OrderedQ[{#1[[k]],#2[[k]]}]& ] works for me with your data.