From 53664714b9a693391054d1c0c601b285f2b1a577 Mon Sep 17 00:00:00 2001 From: iceyrazor Date: Thu, 28 May 2026 18:49:05 -0500 Subject: init --- src/1-1-binary-search-tree.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/1-1-binary-search-tree.c (limited to 'src/1-1-binary-search-tree.c') diff --git a/src/1-1-binary-search-tree.c b/src/1-1-binary-search-tree.c new file mode 100644 index 0000000..cb5efc1 --- /dev/null +++ b/src/1-1-binary-search-tree.c @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include + +typedef struct TREE{ + BS_Node *root; +} TREE; + +int main(int argc, char **argv){ + srand(time(NULL)); + TREE tree = {NULL}; + + for(int i=0; i <40; i++){ + BSAddValue(&tree.root,(int)RandomFloat(0,100)); + } + + BSPrintTree(&tree.root); + BS_Node *found_node = BSSearchTree(&tree.root,53); + if(found_node != NULL) { + printf("53 found %d\n",found_node->value); + } else { + printf("53 not found\n"); + } + BSFreeTree(&tree.root); + return 0; +} + +/* Challanges + * + * balance the tree + */ \ No newline at end of file -- cgit v1.3