AALanguage
The best language for those who have nothing to do
Loading...
Searching...
No Matches
Trie.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <map>
5
15class TrieNode {
16public:
20 TrieNode();
26 TrieNode(char c);
32 ~TrieNode();
38 char get_char();
44 std::map<char, TrieNode*>* get_next();
50 int* get_ends();
56 int* get_count();
57private:
59 std::map<char, TrieNode*> _next;
60 int _ends;
61 int _count;
62};
63
67class Trie {
68public:
72 Trie();
76 Trie(const Trie&) = delete;
82 ~Trie();
92 void add(std::string::iterator itBeg, std::string::iterator itEnd, TrieNode* start = nullptr);
104 TrieNode* find(std::string::iterator itBeg, std::string::iterator itEnd, TrieNode* start = nullptr);
108 void clear();
114 int get_size();
115private:
117};