MathGroup Archive 2009

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103209] Re: how to get the longest ordered sub sequence of a list in
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Thu, 10 Sep 2009 07:23:41 -0400 (EDT)

On 9/9/09 at 4:45 AM, a.dozy.boy at gmail.com (a boy) wrote:

>how to get a (strict or not-strict)decreasing sub sequence of a list?
>----------------
>
>increasing                                   ?

One way to interpret your question would be to find contiguous
blocks within a sequence that are monotonic. If this is your
goal, it can easily be done with Split. For example

Split[list, #1<=#2&]

will split list into a list of lists with each sublist having
non-decreasing order.




  • Prev by Date: DatabaseLink documentation
  • Next by Date: 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: how to get the longest ordered sub sequence of a list in