We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef234b1 commit fbfee20Copy full SHA for fbfee20
implement-trie-prefix-tree/index.go
@@ -0,0 +1,27 @@
1
+package implement_trie_prefix_tree
2
+
3
+type PrefixTree struct {
4
+ isEnd bool
5
+ children map[byte]*PrefixTree
6
+ rest string
7
+}
8
+type Trie struct {
9
+ root *PrefixTree
10
11
12
+func Constructor() Trie {
13
14
+ return Trie{root: &PrefixTree{children: make(map[byte]*PrefixTree)}}
15
16
17
+func (this *Trie) Insert(word string) {
18
19
20
21
+func (this *Trie) Search(word string) bool {
22
23
24
25
+func (this *Trie) StartsWith(prefix string) bool {
26
27
0 commit comments