searching/longest-increasing-subsequence

Algorithm from dynamic programming. It finds the longest sub-sequence of increasing numbers. It is not required the numbers to be neighboring. For example for 1, 5, 2 sequence the longest sub-sequence is 1, 2.
Source:
Parameters:
Name Type Description
array Array Input sequence.
cmp function Comparator.
Returns:
Type:
Array
Longest increasing subsequence.
Example
var subsequence = require('path-to-algorithms/src/searching/'+
'longest-increasing-subsequence').longestIncreasingSubsequence;
console.log(subsequence([1, 0, 4, 3, 5])); // 1, 4, 5