- Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathTrieNode.java
More file actions
Latest commit
27 lines (23 loc) · 553 Bytes
/
Copy pathTrieNode.java
File metadata and controls
27 lines (23 loc) · 553 Bytes
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
importjava.util.LinkedList;
classTrieNode {
chardata;
booleanisEnd;
intcount;
LinkedList<TrieNode> childList;
publicTrieNode(charc) {
childList = newLinkedList<TrieNode>();
isEnd = false;
data = c;
count = 0;
}
publicTrieNodegetChild(charc) {
if (childList != null) {
for (TrieNodeeachChild : childList) {
if (eachChild.data == c) {
returneachChild;
}
}
}
returnnull;
}
}