begin

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
SuffixTree::initializationFromContainer(ConcatenatedUnistringContainer *container) {
std::vector<long> *permutation = container->suffixArray();
std::queue<Task *> task_queue = std::queue<Task>();
root = new TreeVertex();
queue.push(new Task(root, 0, permutation->size() - 1, 0));
while (!queue.empty()) {
Task *task_current = queue.pop();
std::vector<long> factor_positions = std::vector<long>();
std::vector<int> lcp_values = std::vector<int>();
long low = task_current.left_bound;
long high = task_current.right_bound;
int cutted_prefix_size = task_current.cutted_prefix_size;
while (low <= high) {
long middle = (high - low) >> 1;
if (low > high)
break;
lcp1 = container->LCP(low, middle);
lcp2 = container->LCP(low, middle + 1);
if (lcp1 > lcp2) {
task_current->vertex
queue.push(new task());
factor_positions.push_back(middle);
}
}
}
}