From 1fd6b53ecc861d06cb78a426ba98cb49e381ddb7 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Sun, 22 Nov 2020 16:10:13 +0100 Subject: [PATCH] buffet --- cv8/program.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/cv8/program.c b/cv8/program.c index 6fa8953..a497fb1 100644 --- a/cv8/program.c +++ b/cv8/program.c @@ -91,26 +91,7 @@ struct tree* find_minimum(struct tree *root){ void destroy_tree(struct tree* root){ if(root == NULL) return; - - /*if(root->left == NULL && root->right == NULL){ - free(root); - return NULL; - } - else if(root->left == NULL || root->right == NULL){ - struct tree* temp; - if(root->left == NULL){ - temp = root->right; - }else{ - temp = root->left; - } - free(root); - return temp; - } - else { - struct tree* this = find_minimum(root->left); - strcpy(root->value, this->value); - root->right = destroy_tree(root->right); - }*/ + destroy_tree(root->left); destroy_tree(root->right); free(root); @@ -155,7 +136,7 @@ int main(){ printf("Expert z bufetu to vie.\n"); printf("Pozna %d druhov ovocia a zeleniny.\n", count); printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n"); - //printf("%s\n", tree->value); + printf("%s\n", tree->value); search(tree); destroy_tree(tree); printf("Koniec\n");