From 3449fce81ed61d5867589a579c1821946256ded1 Mon Sep 17 00:00:00 2001 From: Miloslav Macko Date: Thu, 18 Apr 2024 15:25:22 +0200 Subject: [PATCH] 123 --- a3/binary_search_tree.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/a3/binary_search_tree.c b/a3/binary_search_tree.c index 8e8cd9d..93946a7 100644 --- a/a3/binary_search_tree.c +++ b/a3/binary_search_tree.c @@ -1,27 +1,10 @@ #include "binary_search_tree.h" #include -#ifndef BINARY_SEARCH_TREE_H -#define BINARY_SEARCH_TREE_H -#include - -typedef struct node node_t; - -struct node { - node_t *right; - node_t *left; - int data; -}; - -node_t *build_tree(int *tree_data, size_t tree_data_len); -void free_tree(node_t *tree); -int *sorted_data(node_t *tree); - -#endif // Deklarace proměnné sorted_index static int sorted_index; -// Deklarace funkce insert +// Definice funkce insert node_t* insert(node_t *node, int data) { if (node == NULL) { node_t *new_node = (node_t*)malloc(sizeof(node_t)); @@ -37,7 +20,7 @@ node_t* insert(node_t *node, int data) { } } -// Deklarace funkce inorder_traversal +// Definice funkce inorder_traversal void inorder_traversal(node_t *node, int *sorted) { if (node == NULL) return; inorder_traversal(node->left, sorted);