Skip to content
Snippets Groups Projects
Commit ee98826f authored by Jan Trávníček's avatar Jan Trávníček
Browse files

simplify SuffixTrie and PositionHeap create algos

parent b3695643
No related branches found
No related tags found
No related merge requests found
...@@ -47,7 +47,7 @@ indexes::PositionHeap < SymbolType > PositionHeapNaive::construct ( const string ...@@ -47,7 +47,7 @@ indexes::PositionHeap < SymbolType > PositionHeapNaive::construct ( const string
unsigned k = i - 1; unsigned k = i - 1;
std::trie < SymbolType, unsigned > * n = & trie; std::trie < SymbolType, unsigned > * n = & trie;
   
while ( k < w.getContent ( ).size ( ) && n->getChildren ( ).count ( w.getContent ( )[k] ) ) while ( n->getChildren ( ).count ( w.getContent ( )[k] ) )
n = & n->getChildren ( ).find ( w.getContent ( )[k++] )->second; n = & n->getChildren ( ).find ( w.getContent ( )[k++] )->second;
   
unsigned node = w.getContent ( ).size ( ) - i + 1; unsigned node = w.getContent ( ).size ( ) - i + 1;
......
...@@ -46,7 +46,7 @@ indexes::SuffixTrie < SymbolType > SuffixTrieNaive::construct ( const string::Li ...@@ -46,7 +46,7 @@ indexes::SuffixTrie < SymbolType > SuffixTrieNaive::construct ( const string::Li
std::trie < SymbolType, std::variant < void, unsigned > > * n = & trie; std::trie < SymbolType, std::variant < void, unsigned > > * n = & trie;
   
// inlined slow_find_one from MI-EVY lectures // inlined slow_find_one from MI-EVY lectures
while ( k < w.getContent ( ).size ( ) && n->getChildren ( ).count ( w.getContent ( )[k] ) ) while ( n->getChildren ( ).count ( w.getContent ( )[k] ) )
n = & n->getChildren ( ).find ( w.getContent ( )[k++] )->second; n = & n->getChildren ( ).find ( w.getContent ( )[k++] )->second;
   
for ( ; k < w.getContent ( ).size ( ); k++ ) { for ( ; k < w.getContent ( ).size ( ); k++ ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment