-
Notifications
You must be signed in to change notification settings - Fork 0
/
trie.h
36 lines (28 loc) · 740 Bytes
/
trie.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
#ifndef MY_LIST_H
#define MY_LIST_H
#include "posting_list.h"
using namespace std;
class my_trie
{
private:
struct node
{
char ch;
node * right;
node * down;
posting_list * pl_ptr; // a pointer to its posting list
};
unsigned int trie_size;
node * first;
void destroy(node * n);
void print_subtrie(node * n, bool full_print);
node * create_node(char ch);
public:
my_trie();
~my_trie();
void print(bool full_print);
unsigned int get_size();
void insert_word(char * word, unsigned int line_id);
posting_list * search_word(const char * query);
};
#endif // MY_LIST_H