Longest common subsequence: Difference between revisions
m
Clarified naming of the FindLCS() method, traceLCS bool, and chains deque.
(Resorted to verbose typedef and parameter names to help clarify their purpose.) |
m (Clarified naming of the FindLCS() method, traceLCS bool, and chains deque.) |
||
Line 493:
typedef deque<INDEXES*> MATCHES;
uint32_t
auto
PAIRS
THRESHOLD threshold;
Line 528:
// divided by factors ranging from 2 up to 10 or more.
//
auto
(limit == threshold.begin() || *prev(limit) < *next(it2));
if (
if (limit == threshold.end()) {
//
threshold.push_back(index2);
// Refresh limit iterator:
limit = prev(threshold.end());
if (
auto prefix = index3 > 0 ?
auto last = make_shared<Pair>(index1, index2, prefix);
}
}
else if (index2 < *limit) {
//
// Update limit value:
*limit = index2;
if (
auto prefix = index3 > 0 ?
auto last = make_shared<Pair>(index1, index2, prefix);
}
}
Line 558 ⟶ 559:
} // next index1
if (
// Return the LCS as a linked list of matched index pairs:
auto last =
// Reverse longest
*pairs = Pair::Reverse(last);
}
Line 606 ⟶ 607:
Match(indexesOf2MatchedByChar, indexesOf2MatchedByIndex1, s1, s2);
shared_ptr<Pair> pairs; // obtain the LCS as index pairs
auto length =
return Select(pairs, length, false, s1, s2);
}
|