-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTrieNode.hpp
45 lines (37 loc) · 1.3 KB
/
TrieNode.hpp
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
/** Filename: TrieNode.hpp
* Name: Loc Chuong
* Userid: cs100sp19aj
* Description: Defines a TrieNode object used to create the Trie.
* Date: 4/29/2019
*/
#ifndef TRIE_NODE_HPP
#define TRIE_NODE_HPP
#include <vector>
#include <string>
#include <queue>
using namespace std;
/** Class Name: TrieNode
* Description: Class that defines a TrieNode with certain char data and
* pointers to its children(left, right, and down). Used to
* create a Ternary Trie.
*/
class TrieNode {
public:
TrieNode * left; /** Pointer to left child */
TrieNode * right; /** Pointer to right child */
TrieNode * down; /** Pointer to child directly below it */
char data; /** Data held by TrieNode */
bool word; /** True if this creates a word, false otherwise */
int freq; /** 0 if word is false, otherwise the frequency of word */
/** Default Constructor
* Description: Creates a node with instance variables of zero-like
* value
*/
TrieNode();
/** Constructor
* Description: Creates a TrieNode with data and bool word false
* Parameters: data - The data for the TrieNode to hold
*/
TrieNode(char data);
};
#endif