Returns the length of the longest common prefix of the i th smallest suffix and the i -1st smallest suffix. @param i an integer between 1 and n -1 @return the length of the longest common prefix of the i th smallest suffix and the i -1st smallest suffix. @thro
(int i)
| 136 | * @throws java.lang.IllegalArgumentException unless {@code 1 <= i < n} |
| 137 | */ |
| 138 | public int lcp(int i) { |
| 139 | if (i < 1 || i >= suffixes.length) throw new IllegalArgumentException(); |
| 140 | return lcpSuffix(suffixes[i], suffixes[i-1]); |
| 141 | } |
| 142 | |
| 143 | // longest common prefix of s and t |
| 144 | private static int lcpSuffix(Suffix s, Suffix t) { |