public abstract class LCS extends Object
| Constructor and Description |
|---|
LCS() |
| Modifier and Type | Method and Description |
|---|---|
int |
getLength() |
protected abstract int |
getLength1() |
protected abstract int |
getLength2() |
protected abstract void |
initializeLcs(int lcsLength) |
protected abstract boolean |
isRangeEqual(int i1,
int i2) |
void |
longestCommonSubsequence(org.eclipse.core.runtime.SubMonitor subMonitor,
LCSSettings settings)
Myers' algorithm for longest common subsequence.
|
protected abstract void |
setLcs(int sl1,
int sl2) |
public void longestCommonSubsequence(org.eclipse.core.runtime.SubMonitor subMonitor,
LCSSettings settings)
Note: Beyond implementing the algorithm as described in the paper I have added diagonal range compression which helps when finding the LCS of a very long and a very short sequence, also bound the running time to (N + M)^1.5 when both sequences are very long.
After this method is called, the longest common subsequence is available by calling getResult() where result[0] is composed of entries from l1 and result[1] is composed of entries from l2
subMonitor - protected abstract int getLength2()
protected abstract int getLength1()
protected abstract boolean isRangeEqual(int i1,
int i2)
protected abstract void setLcs(int sl1,
int sl2)
protected abstract void initializeLcs(int lcsLength)
public int getLength()
Copyright © 2022. All rights reserved.