Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: sort list

  • To: mathgroup at
  • Subject: [mg47242] Re: sort list
  • From: Bill Rowe <readnewsciv at>
  • Date: Wed, 31 Mar 2004 02:59:47 -0500 (EST)
  • Sender: owner-wri-mathgroup at

On 3/30/04 at 4:02 AM, guibout at (Guibout) wrote:

>Hi, I have a list of the form
>{{something1,x1},{something2,x2},{something3,x3}} where x1,x2, x3
>are numbers. I want to sort this list with respect to xi. In other
>word if x2<x3<x1 I want Mathematica to produce:

There are a number of ways to do this. Either

Sort[list, OrderedQ[{Last@#1,Last@#2}]&]



will so what you want. Note, the second of these two methods is much faster for large lists.
To reply via email subtract one hundred and four

  • Prev by Date: Re: sort list
  • Next by Date: Re: Expansion of an exponential expression
  • Previous by thread: Re: sort list
  • Next by thread: Re: sort list