Commit e7a3bb08 authored by Evan Griffiths's avatar Evan Griffiths

All tests on compressed tries are working!

parent f1bc946d
No preview for this file type
......@@ -43,7 +43,22 @@ CompressedTrie *CompressedTrie::_compressTrie(Trie *t) {
}
bool CompressedTrie::query(std::string s) {
return false;
if (children.size() == 0)
return false;
if (children.find(s + "{") != children.end())
return true;
for (size_t i = s.size(); i > 0; i--)
{
std::string key = s.substr(0, i);
if (children.find(key) == children.end())
continue;
return children[key]->query(s.substr(i, s.size() - i));
}
return false;
}
void CompressedTrie::insert(std::string s) {
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment