Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 29th, 2012  |  syntax: None  |  size: 0.36 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Compute transition function
  2. m = length(P);
  3. for  q = 0 through m  do
  4.     for each character  x  in Σ
  5.     k = min(m+1, q+2); // +1 for x, +2 for subsequent repeat loop to decrement
  6.         repeat  k = k-1 // work backwards from q+1
  7.         until  Pk 'is-suffix-of' Pqx;
  8.         d(q, x) = k;    // assign transition table
  9. end for; end for;
  10.  
  11. return  d;
  12. End algorithm.