MathGroup Archive 2009

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

Search the Archive

Re: how to get the longest ordered sub sequence of a

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103218] Re: [mg103158] how to get the longest ordered sub sequence of a
  • From: Fred Simons <f.h.simons at tue.nl>
  • Date: Thu, 10 Sep 2009 07:25:23 -0400 (EDT)
  • References: <200909090845.EAA05996@smc.vnet.net>

a boy wrote:
> how to get a (strict or not-strict)decreasing sub sequence of a list?
>                                              ----------------
>  
> increasing                                   ?
>
>
>   
lst=RandomInteger[{1,100}, {5000}];

With[{sublists=Split[lst, #1<#2&]},
     With[{m=Max[Length /@ sublists]},
          Select[sublists, Length[#]==m&]]]

{{3,19,22,33,51,66,89,95}}

Fred Simons
Eindhoven University of Technology


  • Prev by Date: Re: how to get the longest ordered sub sequence of a list in
  • Next by Date: Re: Bug with Integrate in v7?
  • Previous by thread: how to get the longest ordered sub sequence of a list in
  • Next by thread: Re: how to get the longest ordered sub sequence of a list