Macaulay2 Engine
Loading...
Searching...
No Matches

◆ isPatternPrefix() [2/2]

bool isPatternPrefix ( const Word a,
const Word b,
int startIndex )

Definition at line 100 of file SuffixTree.cpp.

101{
102 // here, a is a pattern label so we only compare the first a.size()-1 many entries
103 // sometimes we know that the first startIndex many symbols will match, so we start
104 // at the first possible non-match.
105 std::cout << a << " " << b << " " << startIndex << std::endl;
106 if (b.size() + 1 < a.size()) return false;
107 Word tmpA = Word(a.begin()+startIndex,a.end()-1);
108 Word tmpB = Word(b.begin()+startIndex, b.begin()+a.size()-1);
109 return (tmpA == tmpB);
110}
const int * begin() const
Definition Word.hpp:72
const int * end() const
Definition Word.hpp:73
int size() const
Definition Word.hpp:74
Non-owning view of a non-commutative word: [begin, end) of int variable indices.
Definition Word.hpp:56

References Word::begin(), Word::end(), and Word::size().

Referenced by isPatternPrefix(), and SuffixTree::subwords().