Esempio n. 1
0
File: ALM2_2.c Progetto: Nigish/UPOL
void inOrderWalk(struct node **root)
{
    if(*root==0)
        return;
    inOrderWalk(&(*root)->left);
    printf("Jmeno: %s\n", (*root)->jmeno);
    inOrderWalk(&(*root)->right);
}
Esempio n. 2
0
// 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);
}
Esempio n. 3
0
// @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;
}
Esempio n. 4
0
File: ALM2_2.c Progetto: Nigish/UPOL
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;
}