include iostream include string include set include map include stdexc

 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
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <stdexcept>
#include "../../include/string/unistring.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#define MAX_PATTERN_LENGTH 1
void DBG(std::string str);
void DBG_S(std::set<Unistring> *finalSet);
bool validatePattern(Unistring *pattern);
Unistring *preProcessPattern(Unistring *pattern);
int findMaxCommonPrefix(Unistring *data, Unistring *pattern);
void merge2Sets(std::set<Unistring> *newSet, std::set<Unistring> *appendSet);
void search_test();
class TrieNode
{
public:
Unistring *data;
bool isFinal;
std::map<unichar, TrieNode*> leaves;
TrieNode(Unistring *ndata, std::map<unichar, TrieNode*> nleaves, bool nflag);
~TrieNode();
void findDownNodes(std::set<Unistring> *wordSet);
void searchWordsFromNode(std::set<Unistring> *wordSet, Unistring *pattern);
};
void DBG_M(std::map<unichar, TrieNode*> leaves);
void DBG_T(TrieNode *tree, int indent);
void DBG_N(TrieNode *node);
class Trie
{
public:
TrieNode *root;
Trie(TrieNode *nroot);
~Trie();
std::set<Unistring> *searchWordsFromTrie(Unistring *pattern);
};