-
Notifications
You must be signed in to change notification settings - Fork 3
/
treemap.h
52 lines (40 loc) · 1.26 KB
/
treemap.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
44
45
46
47
48
49
50
51
52
//
// Created by Ajay on 01-09-2017.
//
#ifndef POCKETDB_TREEMAP_H
#define POCKETDB_TREEMAP_H
#include "input.h"
#define KEY_NOT_FOUND 2
#define FLAG_KEY "~~~~~~~~~~"
typedef unsigned char *byte_array;
typedef struct Node *node;
/*
* container structure for the tree node
*/
typedef struct Node {
node left_child;
node right_child;
char *key;
byte_array value;
}NODE;
typedef struct TreeMap *treemap;
/*
* container structure for a treemap
*/
typedef struct TreeMap {
int size;
node root;
}TREEMAP;
treemap new_tree_map();
treemap tree_put(treemap tree, char *key, cellptr row_data);
node new_node(node root, char *key, byte_array value, int *size);
treemap tree_get_in_range(node tree, char *fkey, char *lkey, treemap range_tree);
int get_in_range(treemap tree, char *fkey, char *lkey, char *file_list[15], int dir_len);
void create_range_tree(treemap range_tree, char *key, byte_array value);
int get_key(treemap root, char *key, char *file_list[15], int dir_len);
node tree_get_node(node root, char *key);
void display_all_nodes(node root);
void display_treemap_node(char *key, cellptr first_cell);
int get_all_keys(treemap tree, char *file_list[15], int dir_len);
treemap tree_get_all(node tree, treemap all_key_tree);
#endif //POCKETDB_TREEMAP_H