MathGroup Archive 2009

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103236] 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:26:47 -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.

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


  • Prev by Date: Re: Stylesheets and templates?
  • Next by Date: Re: Re: how to get the longest ordered sub sequence of a
  • Previous by thread: Re: how to get the longest ordered sub sequence of a list in
  • Next by thread: Re: Re: how to get the longest ordered sub sequence of a