add my unfinished cbase

This commit is contained in:
joachimschmidt557 2020-06-09 17:51:23 +02:00
parent 501065651d
commit bb63a9dd3c
16 changed files with 277 additions and 0 deletions

14
cbase/data/trees/Makefile Normal file
View file

@ -0,0 +1,14 @@
OBJ=binarytree.o bst.o rbtree.o
SRC=$(OBJ:.o=.c)
HDR=$(SRC:.c=.h)
CFLAGS+=-Wall
CFLAGS+=-Wextra
all: $(OBJ)
clean:
$(RM) $(OBJ)
%.o: %.c %.h
$(CC) -o $@ -c $< $(CFLAGS)

View file

@ -0,0 +1 @@
#include "binarytree.h"

View file

@ -0,0 +1,13 @@
#ifndef BINARYTREE_H
#define BINARYTREE_H
typedef struct BinaryTreeNode {
void* data;
struct BinaryTreeNode* left;
struct BinaryTreeNode* right;
} BinaryTreeNode;
BinaryTreeNode*
new_binarytree();
#endif

1
cbase/data/trees/bst.c Normal file
View file

@ -0,0 +1 @@
#include "bst.h"

5
cbase/data/trees/bst.h Normal file
View file

@ -0,0 +1,5 @@
#ifndef BST_H
#define BST_H
#endif

View file

@ -0,0 +1 @@
#include "rbtree.h"

16
cbase/data/trees/rbtree.h Normal file
View file

@ -0,0 +1,16 @@
#ifndef RBTREE_H
#define RBTREE_H
typedef enum {
Red,
Black,
} RBColor;
typedef struct RBTreeNode {
void* data;
struct RBTreeNode* left;
struct RBTreeNode* right;
RBColor color;
} RBTreeNode;
#endif