I knew I was missing something....thanks for the correction and pointer...learn 
something new every day.

Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Advanced GEOINT Solutions Operating Unit
Northrop Grumman Information Systems

________________________________________
From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Igor Tandetnik [itandet...@mvps.org]
Sent: Tuesday, October 16, 2012 8:54 AM
To: sqlite-users@sqlite.org
Subject: EXT :Re: [sqlite] 5. Re: Sqlite, Is it possible to calculate the 
length of the longest increasing subsequence using an UDF

Black, Michael (IS) <michael.bla...@ngc.com> wrote:
> Pseudo-code:
>
> lastchar='';
> For (char c in array)
>  if (lastchar = '' || c = lastchar+1)
>    curseq.push(c);
>  else
>    curseq.clear();
>    curseq..push(c);
>  end

The longest increasing subsequence doesn't need to be contiguous. Nor does the 
difference between two neighboring elements have to be exactly one - it just 
have to be a positive number. At least as defined at

http://en.wikipedia.org/wiki/Longest_increasing_subsequence

E.g. for a sequence of (1, 100, 2, 4) your algorithm finds (1), while the 
correct answer is (1, 2, 4).
--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to