feat: begin binary tree implementation

dev^2
Jef Roosens 2023-01-19 21:22:08 +01:00 committed by Chewing_Bever
parent 379a05a7b6
commit df50f96983
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
3 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,15 @@
#ifndef VIETER_TREE
#define VIETER_TREE
#include <stdint.h>
typedef struct vieter_tree vieter_tree;
typedef enum vieter_tree_error {
vieter_tree_ok = 0,
vieter_tree_already_present = 1
} vieter_tree_error;
vieter_tree_error vieter_tree_insert(uint64_t key, void *data);
#endif

13
src/tree/node.h 100644
View File

@ -0,0 +1,13 @@
#ifndef VIETER_BALANCED_TREE_NODE
#define VIETER_BALANCED_TREE_NODE
#include <stdint.h>
typedef struct vieter_tree_node {
uint64_t key;
void *data;
struct vieter_tree_node *left;
struct vieter_tree_node *right;
} vieter_tree_node;
#endif

6
src/tree/tree.c 100644
View File

@ -0,0 +1,6 @@
#include "vieter_tree.h"
#include "node.h"
struct vieter_tree {
uint64_t size;
};