rendered paste body#include "mylib.h"
void preorder(BinTreeType aTree)
{
StackType *stack; /*Stoiva dieu8unsewn kombwn dentrou*/
BinTreeNodeType *current; /*Trexon deikths dentrou*/
StackNodeType *temp; /*Xrhsimeuei ws bathras gia thn pop - (pop(stack))->value?*/
stack = createStack();
current = aTree.root;
do {
while (current != NULL) {
printNode(current);
stack = push(stack, current->right);
current = current->left;
}
if (!isEmptyStack(stack)) {
temp = pop(stack);
current = temp->value;
}
}while (!isEmptyStack(stack) || (current->next==NULL));
}
void inorder(BinTreeType *aTree)
{
/*BinTreeNodeType *current;
current = aTree->root;*/
if (aTree->root != NULL) {
inorder(aTree->root->left);
printNode(aTree->root->value);
inorder(aTree->root->right);
}
}
void postorder(BinTreeType *aTree)
{
/*BinTreeNodeType *current;
current = aTree->root;*/
if (aTree->root != NULL) {
postorder(aTree->root->left);
postorder(aTree->root->right);
printNode(aTree->root->value);
}
}