MCPcopy
hub / github.com/kevin-wayne/algs4 / lcp

Method lcp

src/main/java/edu/princeton/cs/algs4/SuffixArray.java:138–141  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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) {

Callers 3

mainMethod · 0.95
lrsMethod · 0.95
mainMethod · 0.95

Calls 1

lcpSuffixMethod · 0.95

Tested by

no test coverage detected