From af003ab57857b263f113da4a064b2dfe32e1de4d Mon Sep 17 00:00:00 2001 From: Michal Utlak Date: Tue, 23 Apr 2024 19:33:27 +0200 Subject: [PATCH] skuskaa --- a3/binary_search_tree.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 a3/binary_search_tree.c diff --git a/a3/binary_search_tree.c b/a3/binary_search_tree.c new file mode 100644 index 0000000..f5ff94e --- /dev/null +++ b/a3/binary_search_tree.c @@ -0,0 +1,21 @@ +#include +#include +#include +#include "binary_search_tree.h" + +node_t *build_tree(int *tree_data, size_t tree_data_len){ + + node_t *koren = (node_t *)malloc(sizeof(node_t)); + + if(tree_data == NULL || tree_data_len == NULL){ + return 0; + } + + if(tree_data != NULL && tree_data_len != NULL){ + koren->data = tree_data[0]; + koren->left = tree_data[0]; + } + + return koren; +} +