Re: Re: how to get the longest ordered sub sequence of a
- To: mathgroup at smc.vnet.net
- Subject: [mg103241] Re: [mg103215] Re: how to get the longest ordered sub sequence of a
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Fri, 11 Sep 2009 05:27:42 -0400 (EDT)
- References: <h87pgp$5gt$1@smc.vnet.net> <200909101124.HAA18303@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
> I've been assuming the OP wanted the LONGEST increasing subsequence. > > But he never said that. Oops, yes he did... in the subject line... and the code below doesn't do it. Bobby On Thu, 10 Sep 2009 18:08:18 -0500, DrMajorBob <btreat1 at austin.rr.com> wrote: > I've been assuming the OP wanted the LONGEST increasing subsequence. > > But he never said that. > > D'oh! > > Bobby > > On Thu, 10 Sep 2009 06:24:48 -0500, dh <dh at metrohm.com> wrote: > >> >> >> Hi, >> >> we can do this with intermediate variables. >> >> E.g. assume the data is in d: >> >> d = RandomInteger[10, 12] >> >> then we get an non-strict increasing sub list by: >> >> t = d[[1]]; >> >> Select[d, If[# >= t, t = #; True, False] &] >> >> the following gives a strict increasing sub list, without the first >> >> element, that we need to append later: >> >> t = d[[1]]; >> >> Select[d, If[# > t, t = #; True, False] &] >> >> Daniel >> >> >> >> a boy wrote: >> >>> how to get a (strict or not-strict)decreasing sub sequence of a list? >> >>> ---------------- >> >>> >> >>> increasing ? >> >>> >> >> >> > > -- DrMajorBob at yahoo.com
- References:
- Re: how to get the longest ordered sub sequence of a list in
- From: dh <dh@metrohm.com>
- Re: how to get the longest ordered sub sequence of a list in