This commit is contained in:
Maryna Kravtsova 2020-11-22 16:10:13 +01:00
parent cfb3f31df3
commit 1fd6b53ecc

View File

@ -92,25 +92,6 @@ 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");