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
15
class
TrieNode
{
16
public
:
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
();
57
private
:
58
char
_curr_char
;
59
std::map<char, TrieNode*>
_next
;
60
int
_ends
;
61
int
_count
;
62
};
63
67
class
Trie
{
68
public
:
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
();
115
private
:
116
TrieNode
*
_root
;
117
};
D:
GitHub
AALanguage2
AALanguage
Trie.h
Generated by
1.10.0