-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtrie.h
37 lines (29 loc) · 946 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
37
#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(dir ** dirs, node * n, bool full_print);
node * create_node(char ch);
public:
my_trie();
~my_trie();
void print(dir ** dirs, bool full_print);
unsigned int get_size();
void insert_word(char * word, unsigned int dir_index, unsigned int text_file_index, unsigned int line_index);
unsigned int insert_docs(char ** docs, unsigned int nlines, unsigned int dir_index, unsigned int text_file_index);
posting_list * search_word(const char * query);
};
#endif // MY_LIST_H