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
- References:
- how to get the longest ordered sub sequence of a list in
- From: a boy <a.dozy.boy@gmail.com>
- how to get the longest ordered sub sequence of a list in