MathGroup Archive 2006

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

Search the Archive

Re: Insertion into sorted list


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