wnjfsdjnf

This commit is contained in:
Anton Dolozin 2025-11-09 21:05:49 +01:00
parent 51955157f3
commit a8d91996df

View File

@ -78,6 +78,18 @@ int count_leaves(struct tree* tree){
}
}
int count_non_leaves(struct tree* tree){
int count = 0;
if(tree == NULL){
return count;
}
if(tree->left && tree->right){
return count + count_leaves(tree->left) + count_leaves(tree->right);
}
return count+1;
}
int main(void){
bool whitespace = false;
@ -94,9 +106,11 @@ int main(void){
break;
}
}
int res = count_non_leaves(tree);
int res2 = numOfLeaves - res;
bool found = find_the_incorrect(tree);
printf("Expert z bufetu to vie.\n");
if(!tree || !whitespace || found){
if(!tree || !whitespace || found || res2 < 1){
printf("Chybna databaza\n");
return 0;
}