-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmyTrie.h
More file actions
38 lines (24 loc) · 725 Bytes
/
myTrie.h
File metadata and controls
38 lines (24 loc) · 725 Bytes
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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#ifndef _TRIE
#define _TRIE
#define CHAR_TO_INDEX(c) ((int)c - (int)'a')
#define ALPHABET_SIZE 26
struct TrieNode{
struct TrieNode** children; //[ALPHABET_SIZE];
bool end;
unsigned int frequency;
unsigned int last_doc;
};
typedef struct TrieNode TrieNode;
TrieNode* get_Node(void);
TrieNode* trie_insert(TrieNode *root, char *key, int current_doc);
TrieNode* merge_trie(TrieNode *base,TrieNode *droot);
int* divide(int num_of_proc);
//char* convert_to_lower(char* str);
//char index_to_char(int index);
int trie_free(TrieNode* dnode);
TrieNode* print_trie(TrieNode* root, int alpha, char* buffer, int iter);
#endif