[−][src]Function longest_increasing_subsequence::lis
pub fn lis<T>(items: &[T]) -> Vec<usize> where
T: Ord,
The high-level, easy-to-use function for finding a longest increasing subsequence.
Takes any slice &[T]
and uses the T: Ord
implementation to determine the
LIS.
The LIS is returned as a vector of indices into the input items slice.
Example
use longest_increasing_subsequence::lis; let xs = vec![9, 2, 8, 3, 5]; for i in lis(&xs) { println!("{} at index {}", xs[i], i); } // Prints: // 2 at index 1 // 3 at index 3 // 5 at index 4