Editing Longest increasing subsequence
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 20: | Line 20: | ||
===Optimal substructure=== | ===Optimal substructure=== | ||
− | The value for <math>\operatorname{LIS}'(i)</math> consists of either: | + | The dynamic substructure is not too hard to see. The value for <math>\operatorname{LIS}'(i)</math> consists of either: |
* the element <math>x_i</math> alone, which always forms an increasing subsequence by itself, or | * the element <math>x_i</math> alone, which always forms an increasing subsequence by itself, or | ||
* the element <math>x_i</math> tacked on to the end of an increasing subsequence ending with <math>x_j</math>, where <math>j < i</math> and <math>x_j \leq x_i</math> (for the non-strict case) or <math>x_j < x_i</math> (for the strict case). | * the element <math>x_i</math> tacked on to the end of an increasing subsequence ending with <math>x_j</math>, where <math>j < i</math> and <math>x_j \leq x_i</math> (for the non-strict case) or <math>x_j < x_i</math> (for the strict case). |