[xquery-talk] longest sequence of monotonically increasing integers

Michael Kay mhk at mhk.me.uk
Fri Mar 3 10:08:30 PST 2006


Returning to this, I'm not sure if I misread the requirement or if you
miswrote it. Surely the sequence 

( 1945, 1951, 1952, 1952, 1953, 1961, 1962, 1998 )

is monotonically increasing and therefore the longest monotonically
increasing subsequence has length 8?

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: talk-bounces at xquery.com 
> [mailto:talk-bounces at xquery.com] On Behalf Of Howard Katz
> Sent: 03 March 2006 02:29
> To: talk at xquery.com
> Subject: [xquery-talk] longest sequence of monotonically 
> increasing integers
> 
> Anybody have a nice method of finding the length of the longest
> monotonically increasing subsequence in a sequence of 
> integers? For example
> given
> 
>      ( 1945, 1951, 1952, 1952, 1953, 1961, 1962, 1998 )
> 
> I need to be able to derive "3" for the run ( 1951, 1952, 
> 1953 ). The double
> entry for "1952" can be ignored.
> 
> TIA,
> Howard
> 
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk
> 




More information about the talk mailing list