Re: Re: Sorting a list of pairs on the second elements
- To: mathgroup at smc.vnet.net
- Subject: [mg51453] Re: Re: Sorting a list of pairs on the second elements
- From: "Peltio" <peltio at twilight.zone>
- Date: Sun, 17 Oct 2004 21:49:43 -0400 (EDT)
- References: <cklmi7$f1o$1@smc.vnet.net> <200410150647.CAA05265@smc.vnet.net> <200410160820.EAA23720@smc.vnet.net> <ckt7a7$7as$1@smc.vnet.net>
- Reply-to: "Peltio" <peltioNOSP at Mdespammed.com.invalid>
- Sender: owner-wri-mathgroup at wolfram.com
"DrBob" wrote
>Both methods do the same thing at my machine,
They should not when the data is actually made of Strings.
sss={{"ttcttgcctttgcgg","121"},...}
and not symbols and integers as in
sss={{ttcttgcctttgcgg,121},...}
>and there's also a third method that may do better: [snip]
> Reverse /@ Sort[Reverse /@ sss]
I had already tried that one but it was slower than
Transpose@Reverse@Transpose@Sort@Transpose@Reverse@Transpose[
sss]
Mapping Reverse on every row of a long list is more time consuming than
tranposing the matrix and swapping its *two* long rows.
This is the side effect of working with an interpreted language, I guess.
cheers,
Peltio
Invalid address in reply-to. Crafty demunging required to mail me.
- Follow-Ups:
- Re: Re: Re: Sorting a list of pairs on the second elements
- From: DrBob <drbob@bigfoot.com>
- Re: Re: Re: Sorting a list of pairs on the second elements
- References:
- Re: Sorting a list of pairs on the second elements
- From: "Peltio" <peltio@twilight.zone>
- Re: Re: Sorting a list of pairs on the second elements
- From: János <janos.lobb@yale.edu>
- Re: Sorting a list of pairs on the second elements