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: [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


  • Prev by Date: Re: Re: confused about asserting variable is
  • Next by Date: Re: Graphics > Drawing Tools > Get Coordinates Snow Leopard
  • Previous by thread: Re: Re: how to get the longest ordered sub sequence of a
  • Next by thread: Inconsistent behaviour of StudentTDistribution