From ee98826fde0d63129ec2fd5cee80ee03b07261ea Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Mon, 6 Feb 2017 13:26:43 +0100 Subject: [PATCH] simplify SuffixTrie and PositionHeap create algos --- alib2algo/src/stringology/indexing/PositionHeapNaive.h | 2 +- alib2algo/src/stringology/indexing/SuffixTrieNaive.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/alib2algo/src/stringology/indexing/PositionHeapNaive.h b/alib2algo/src/stringology/indexing/PositionHeapNaive.h index 71d40b0e53..e523eedb27 100644 --- a/alib2algo/src/stringology/indexing/PositionHeapNaive.h +++ b/alib2algo/src/stringology/indexing/PositionHeapNaive.h @@ -47,7 +47,7 @@ indexes::PositionHeap < SymbolType > PositionHeapNaive::construct ( const string unsigned k = i - 1; 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; unsigned node = w.getContent ( ).size ( ) - i + 1; diff --git a/alib2algo/src/stringology/indexing/SuffixTrieNaive.h b/alib2algo/src/stringology/indexing/SuffixTrieNaive.h index 9d2b0a668f..02ea1a1899 100644 --- a/alib2algo/src/stringology/indexing/SuffixTrieNaive.h +++ b/alib2algo/src/stringology/indexing/SuffixTrieNaive.h @@ -46,7 +46,7 @@ indexes::SuffixTrie < SymbolType > SuffixTrieNaive::construct ( const string::Li std::trie < SymbolType, std::variant < void, unsigned > > * n = & trie; // 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; for ( ; k < w.getContent ( ).size ( ); k++ ) { -- GitLab