void inOrderWalk(struct node **root) { if(*root==0) return; inOrderWalk(&(*root)->left); printf("Jmeno: %s\n", (*root)->jmeno); inOrderWalk(&(*root)->right); }
// Projde pole a vypíše čísla vzestupně void inOrderWalk(struct node **root) { if(*root==0) return; inOrderWalk(&(*root)->left); printf("%i ", (*root)->number); inOrderWalk(&(*root)->right); }
// @TODO dopsat funkci pro vytvoření stromu, aby byl veškerý kód ve funkcích int main(int argc, char **argv) { struct node *tree = 0; add(1, &tree); add(2, &tree); add(3, &tree); add(4, &tree); add(5, &tree); add(6, &tree); add(7, &tree); printf("Height: %i\n", maxHeight(&tree)); printf("inOrderWalk: "); inOrderWalk(&tree); printf("\n"); printf("preOrderWalk: "); preOrderWalk(&tree); printf("\n"); printf("postOrderWalk: "); postOrderWalk(&tree); printf("\n"); return 0; }
int main(int argc, char **argv) { struct node *tree = 0; int i; for (i = 0; i < Pocet ; i++) { add(Jmena[i], &tree); } inOrderWalk(&tree); printf("Výška stromu: %i\n", maxvyska(&tree)); return 0; }