From 46d025cf6db91721925a72bf4de8a4c75a5e8264 Mon Sep 17 00:00:00 2001 From: Miloslav Macko Date: Thu, 18 Apr 2024 15:13:09 +0200 Subject: [PATCH] 123 --- a3/binary_search_tree.c | 50 ----------------------------------------- 1 file changed, 50 deletions(-) diff --git a/a3/binary_search_tree.c b/a3/binary_search_tree.c index db70744..cec60c4 100644 --- a/a3/binary_search_tree.c +++ b/a3/binary_search_tree.c @@ -1,53 +1,3 @@ -/*#include - -typedef struct Node { - int data; - struct Node* left; - struct Node* right; -} Node; - -Node* newNode(int data); -Node* insert(Node* node, int data); -int search(Node* root, int x); -void build_tree(); // Deklarace funkce build_tree -void free_tree(); // Deklarace funkce free_tree - -Node* newNode(int data) { - Node* node = (Node*)malloc(sizeof(Node)); - node->data = data; - node->left = NULL; - node->right = NULL; - return node; -} - -Node* insert(Node* node, int data) { - if (node == NULL) { - return newNode(data); - } - else { - if (data <= node->data) node->left = insert(node->left, data); - else node->right = insert(node->right, data); - return node; - } -} - -int search(Node* root, int x) { - if(root == NULL) return 0; - if(root->data == x) return 1; - else if(root->data < x) return search(root->right, x); - else return search(root->left, x); -} - -// Implementace funkce build_tree -void build_tree() { - // Zde implementujte vytvoření stromu -} - -// Implementace funkce free_tree -void free_tree() { - // Zde implementujte uvolnění paměti použité pro strom -}*/ - #include #include // Přidáno pro účely výstupu