MathGroup Archive 2006

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

Search the Archive

Re: Insertion into sorted list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71058] Re: Insertion into sorted list
  • From: "dimitris" <dimmechan at yahoo.com>
  • Date: Wed, 8 Nov 2006 06:11:12 -0500 (EST)
  • References: <eimq10$9b7$1@smc.vnet.net>

Something like?

lst = Sort[Table[Random[Integer, {1, 15}], {20}]]
{1, 1, 1, 1, 1, 4, 4, 7, 7, 7, 7, 8, 9, 11, 11, 13, 13, 13, 13, 15}

sortins[lis_List, x_] := Sort[Flatten[{lis, x}, 1]]

sortins[lst, Range[20, 25]]
{1, 1, 1, 1, 1, 4, 4, 7, 7, 7, 7, 8, 9, 11, 11, 13, 13, 13, 13, 15, 20,
21, 22, 23, 24, 25}

Regards
Dimitris


  • Prev by Date: Simplifying in Mathematica
  • Next by Date: Re: building a list containing elements f(i,j)
  • Previous by thread: Re: Insertion into sorted list
  • Next by thread: Re: Insertion into sorted list