Longest [increment] subsequence: note that there is no public sequence, that is, there is only one sequence.

Source: Internet
Author: User

Monotonic: monotonous.

The sequence is X = (x1, x2, X3, x4...). First, sort X to get x', and find the longest common subsequence (LCS) of x and x.

 

 

Another way of thinking:

First, review the classical O (N ^ 2) dynamic planning algorithm, set a [I] to representNumber,F [I] indicates the length of the longest ascending subsequence ending with I from 1 to I.In the initial phase, F [I] = 0; (I = 1, 2,..., Len ()). Then there is a dynamic planning equation: F [I] = max {1, F [J] + 1} (j = 1, 2 ,..., i-1, and a [J] <A [I]).

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.