MathGroup Archive 2004

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

Search the Archive

Sort by buried element in list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48899] Sort by buried element in list
  • From: Steve Gray <stevebg at adelphia.net>
  • Date: Tue, 22 Jun 2004 05:32:12 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

	What's the best way to sort a multilevel list of the following
type, using as the key the entries 065794, 205347, 000000, 004354,
etc.? Of course I need all sublists sorted with the key. The entire
list may be several thousand entries long. Speed is not much of a
concern. The entries are computed one at a time, and the sort could be
done at that time or all at once later. I need to (optionally) remove
entries with duplicate keys, regardless of the other items in the
entry. The position of the key is known beforehand (obviously).

{{65,98},{44,66},{48,69},{12,54},{98,59},{33,75}},{065794,{0,1,0,1,0,2}}
{{12,84},(04,79},{92,52},{01,71},{49,80},{96,44}},{205347,{0,3,2,2,2,3}}
{{83,81},{52,77},{17,29},{33,13},{49,10},{78,78}},{000000,{0,0,0,0,0,0}}
{{38,25},{74,97},{18,32},{02,08},{43,71},{04,27}},{004354,{0,0,1,1,0,2}}

	The final result for this small sample would be

{{83,81},{52,77},{17,29},{33,13},{49,10},{78,78}},{000000,{0,0,0,0,0,0}}
{{38,25},{74,97},{18,32},{02,08},{43,71},{04,27}},{004354,{0,0,1,1,0,2}}
{{65,98},{44,66},{48,69},{12,54},{98,59},{33,75}},{065794,{0,1,0,1,0,2}}
{{12,84},(04,79},{92,52},{01,71},{49,80},{96,44}},{205347,{0,3,2,2,2,3}}

	Thanks for any info.

Steve Gray



  • Prev by Date: Mathematica on Linux
  • Next by Date: Re: Page Layout
  • Previous by thread: Re: Mathematica on Linux
  • Next by thread: Re: Sort by buried element in list