Struct alcs::Alcs [] [src]

pub struct Alcs { /* fields omitted */ }

Methods

impl Alcs
[src]

[src]

Constructs a structure able to return all the Longest Common Subsequences between a and each substring of b

It requires O(|a|+|b|) space and O(|a|*|b|) time

let a = "word";
   let b = "hello world";
   let va = a.chars().collect::<Vec<char>>();
   let vb = b.chars().collect::<Vec<char>>();
   let alcs = Alcs::new(&va, &vb);
   // this will actually take O(|b|^2)
   for i in 0..b.len() {
       for (i, j, cij) in alcs.suffix(i) {
           println!("LCS between '{}' and '{}' has length {}",a,&b[i..j],cij);
       }
   }

[src]

Returns an iterator yielding the LCS length for all substrings starting from position i