-
Notifications
You must be signed in to change notification settings - Fork 0
/
boggleutil.h
executable file
·44 lines (39 loc) · 993 Bytes
/
boggleutil.h
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
//Malcolm Samuel <m1samuel>
#ifndef BOGGLEUTIL_H
#define BOGGLEUTIL_H
//Data structures for lexicon and board should reside in this file.
//All of the operations your data structures support should be declared within your data structures.
#endif
#include <vector>
#include <string>
#include <set>
class TrieNode{
public:
TrieNode(char);
void setSymbol(int);
void setLast();
bool isLastSymbolInLexeme();
char getSymbol();
TrieNode *getLeft();
TrieNode *getRight();
TrieNode *getMid();
void setLeft(TrieNode*);
void setRight(TrieNode*);
void setMid(TrieNode*);
private:
bool isLast;
char c;
TrieNode *left,*middle,*right;
};
class TernaryTrie{
public:
TernaryTrie();
~TernaryTrie();
void deleteTrie(TrieNode*);
TrieNode *top(){return root;}
TrieNode *insert(TrieNode*,std::string,unsigned int);
int find(const std::string&);
void buildTree(const std::vector<std::string>&);
private:
TrieNode *root;
};