Longest Increasing Subsequence
المؤلف:
Pemmaraju, S. and Skiena, S.
المصدر:
"Longest Increasing Subsequences." §4.4.6 in Computational Discrete Mathematics: Combinatorics and Graph Theory in Mathematica. Cambridge, England: Cambridge University Press
الجزء والصفحة:
...
1-11-2020
1252
Longest Increasing Subsequence
The longest increasing (contiguous) subsequence of a given sequence is the subsequence of increasing terms containing the largest number of elements. For example, the longest increasing subsequence of the permutation
{6,3,4,8,10,5,7,1,9,2}" src="https://mathworld.wolfram.com/images/equations/LongestIncreasingSubsequence/Inline1.gif" style="height:15px; width:159px" /> is
{3,4,8,10}" src="https://mathworld.wolfram.com/images/equations/LongestIncreasingSubsequence/Inline2.gif" style="height:15px; width:69px" />.
It can be coded in the Wolfram Language as follows.
<<Combintorica`
LongestContinguousIncreasingSubsequence[p_] :=
Last[
Split[Sort[Runs[p]], Length[#1] >= Length[#2]&]
]
REFERENCES:
Pemmaraju, S. and Skiena, S. "Longest Increasing Subsequences." §4.4.6 in Computational Discrete Mathematics: Combinatorics and Graph Theory in Mathematica. Cambridge, England: Cambridge University Press, pp. 170-172, 2003.
Skiena, S. "Longest Increasing Subsequences." §2.3.6 in Implementing Discrete Mathematics: Combinatorics and Graph Theory with Mathematica. Reading, MA: Addison-Wesley, pp. 73-75, 1990.
الاكثر قراءة في نظرية الاعداد
اخر الاخبار
اخبار العتبة العباسية المقدسة