From 372af9355037bbe8a0f5e800c6866f5fb62e4a51 Mon Sep 17 00:00:00 2001 From: Michal Utlak Date: Tue, 23 Apr 2024 19:43:45 +0200 Subject: [PATCH] neviem --- a3/binary_search_tree.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/a3/binary_search_tree.c b/a3/binary_search_tree.c index daa541d..f95c12c 100644 --- a/a3/binary_search_tree.c +++ b/a3/binary_search_tree.c @@ -3,6 +3,17 @@ #include #include "binary_search_tree.h" +void free_tree(node_t *tree) { + if (tree == NULL) { + return 0; + } + + free_tree(tree->left); + free_tree(tree->right); + + free(tree); +} + node_t *build_tree(int *tree_data, size_t tree_data_len){ node_t *koren = (node_t *)malloc(sizeof(node_t));