binarytree/binarytree.c
/*****************************************************************************/
/* Displays the tree traversed in ascending order according to stored values.
 * */
Displays the tree traversed in ascending order according to stored values.
Displays the tree traversed in ascending order according to stored values .
void showNodeOrdered(Node *node, int parent, int leftRight){
    if(DEBUG==1) printf("Checkpoint: Function %s, line %d\n", __func__, __LINE__);
    if (node->left)  showNodeOrdered(node->left, node->id, 0);
    if (node){
            printf("Node: ID = % 4i, value = % 4i, parent ID = % 4i", 
                    node->id, node->val, parent);
        if (leftRight==0){
            printf(", Type: Left.\n");
        }
        if (leftRight==1){
            printf(", Type: Right.\n");
        }
        if (leftRight==-1){
            printf(", Type: Root.\n");
        }
    }
    if (node->right) showNodeOrdered(node->right, node->id, 1);
}
void showNodeOrdered ( Node * node , int parent , int leftRight ) { if ( DEBUG == 1 ) printf ( " \n " , __func__ , __LINE__ ) ; if ( node -> left ) showNodeOrdered ( node -> left , node -> id , 0 ) ; if ( node ) { printf ( " " , node -> id , node -> val , parent ) ; if ( leftRight == 0 ) { printf ( " \n " ) ; } if ( leftRight == 1 ) { printf ( " \n " ) ; } if ( leftRight == -1 ) { printf ( " \n " ) ; } } if ( node -> right ) showNodeOrdered ( node -> right , node -> id , 1 ) ; }
Displays the tree traversed in ascending order according to stored values.
Displays the tree traversed in ascending order according to stored values .