Homework/HW07/bin-trees-B.cc
void growNewLeaves (nodePtr & rootp)
{
    if (!rootp)
    {
        //Base case.  If a node doesn't exist, create it.
        rootp = new node;

        //Test to make sure the memory was allocated.
        testDynamicAllocation(rootp);

        //Set the default values of the node.
        rootp->datum = 0;
        rootp->left = NULL;
        rootp->right = NULL;
    }
    else
    {
        //This node exists.  Continue to recurse through the tree.
        growNewLeaves(rootp->left);
        growNewLeaves(rootp->right);
    }

}
/**********************  G R O W   N E W   L E A V E S  ****************

The following function adds a leaf to the binary tree pointed to by rootp
at every point at which the current tree has an empty subtree.  The datum
member in each new leaf is given the value 0 .  If the tree is empty, then
exactly one node is added to the tree.  The function is recursive.
The function documentation and heading were written by W. Knight.   */
G R O W   N E W   L E A V E S
The following function adds a leaf to the binary tree pointed to by rootp
at every point at which the current tree has an empty subtree.  The datum
member in each new leaf is given the value 0 .  If the tree is empty, then
exactly one node is added to the tree.  The function is recursive.
The function documentation and heading were written by W. Knight.
G R O W N E W L E A V E S The following function adds a leaf to the binary tree pointed to by rootp at every point at which the current tree has an empty subtree . The datum member in each new leaf is given the value 0 . If the tree is empty then exactly one node is added to the tree . The function is recursive . The function documentation and heading were written by W . Knight .
void growNewLeaves (nodePtr & rootp)
{
    if (!rootp)
    {
        rootp = new node;
        testDynamicAllocation(rootp);
        rootp->datum = 0;
        rootp->left = NULL;
        rootp->right = NULL;
    }
    else
    {
        growNewLeaves(rootp->left);
        growNewLeaves(rootp->right);
    }
}
void growNewLeaves ( nodePtr & rootp ) { if ( ! rootp ) { rootp = new node ; testDynamicAllocation ( rootp ) ; rootp -> datum = 0 ; rootp -> left = NULL ; rootp -> right = NULL ; } else { growNewLeaves ( rootp -> left ) ; growNewLeaves ( rootp -> right ) ; } }
G R O W   N E W   L E A V E S
The following function adds a leaf to the binary tree pointed to by rootp
at every point at which the current tree has an empty subtree.
G R O W N E W L E A V E S The following function adds a leaf to the binary tree pointed to by rootp at every point at which the current tree has an empty subtree .
//Base case.  If a node doesn't exist, create it. //Test to make sure the memory was allocated. //Set the default values of the node. //This node exists.  Continue to recurse through the tree.