#include #include #include #include #define SIZE 100 struct tree { //otazka ab. odpoved char value[SIZE]; // Odpove� �no struct tree* left; // Odpove� nie struct tree* right; }tree; void print_tree(struct tree* tree,int offset){ for (int i = 0; i < offset; i++){ printf(" "); } printf("%s",tree->value); if (tree->left){ print_tree(tree->left,offset +3); print_tree(tree->right,offset +3); } } void destroy_tree(struct tree* tree){ free(tree); } struct tree* read_tree(){ char buffer[SIZE]; memset(buffer,0,SIZE); char* r = fgets(buffer,SIZE,stdin); assert(r); struct tree* node = calloc(1,sizeof(struct tree)); memcpy(node->value,buffer,SIZE); // Ak je nacitany riadok listovy uzol ,tak netreba robit nic // inak rekurzivne nacitanie laveho syna // a rekurzivne nacitanie praveho syna return node; } int main(){ /*int counter = 0; int si = 0; struct tree* stack[SIZE]; struct tree* this = tree; while (si >= 0){ assert(si < SIZE); if (this->left){ stack[si++] = this; this = this->left; continue; } counter += 1; if (this->right){ stack[si++] = this; this = this->right; continue; } si = si -1;*/ return 0; }