Lab8/avl_bag_lab8.c
/* FUNCTION avl_print
 *    Print every value in the subtree rooted at root to stdout, in a "sideways
 *    tree" layout with the root at the given depth.  Print each node's element
 *    and height.
 * Parameters and preconditions:
 *    root != NULL: the root of the subtree to print
 *    depth >= 0: the depth at which to print the root's value
 *    indent > 0: number of spaces to print for each level of depth
 *    print != NULL: the function to use to print each node's value
 * Return value:  none
 * Side-effects:
 *    every value in the subtree rooted at root is printed to stdout, using a
 *    "sideways tree" layout (with right subtrees above and left subtrees below,
 *    and indentation to indicate each value's depth in the tree)
 */
FUNCTION avl_print
Print every value in the subtree rooted at root to stdout, in a "sideways
tree" layout with the root at the given depth.  Print each node's element
and height.
FUNCTION avl_print Print every value in the subtree rooted at root to stdout in a " sideways tree " layout with the root at the given depth . Print each node ' s element and height .
static
void avl_print(const avl_node_t *root, int depth, int indent,
               void (*print)(bag_elem_t))
{
    if (root) {
        avl_print(root->right, depth + 1, indent, print);
        printf("%*s", depth * indent, "");
        (*print)(root->elem);
        printf(" [%lu]\n", root->height);
        avl_print(root->left, depth + 1, indent, print);
    }
}
static void avl_print ( const avl_node_t * root , int depth , int indent , void ( * print ) ( bag_elem_t ) ) { if ( root ) { avl_print ( root -> right , depth + 1 , indent , print ) ; printf ( " " , depth * indent , " " ) ; ( * print ) ( root -> elem ) ; printf ( " \n " , root -> height ) ; avl_print ( root -> left , depth + 1 , indent , print ) ; } }
FUNCTION avl_print
    Print every value in the subtree rooted at root to stdout, in a "sideways
    tree" layout with the root at the given depth.
FUNCTION avl_print Print every value in the subtree rooted at root to stdout in a " sideways tree " layout with the root at the given depth .
/* Print each value followed by its depth, with INDENT spaces of
         * indentation for each level of depth in the tree. */