-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrieNode.java
More file actions
63 lines (55 loc) · 1.05 KB
/
TrieNode.java
File metadata and controls
63 lines (55 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package datastructure.trie;
/**
* The type Trie node.
*/
public class TrieNode {
/**
* Get children trie node [ ].
*
* @return the trie node [ ]
*/
public TrieNode[] getChildren() {
return children;
}
/**
* Is end word boolean.
*
* @return the boolean
*/
public boolean isEndWord() {
return isEndWord;
}
/**
* The Children.
*/
private TrieNode children[];
/**
* The Is end word.
*/
private boolean isEndWord;
/**
* The Alphabet size.
*/
static final int ALPHABET_SIZE = 26;
/**
* Instantiates a new Trie node.
*/
TrieNode(){
this.isEndWord=false;
this.children= new TrieNode[ALPHABET_SIZE];
}
/**
* Mark as leaf.
*/
//Function to mark the currentNode as Leaf
public void markAsLeaf(){
this.isEndWord = true;
}
/**
* Un mark as leaf.
*/
//Function to unMark the currentNode as Leaf
public void unMarkAsLeaf(){
this.isEndWord = false;
}
}