CMSC-341, Fall 1999, Sections 0101
Binary Search Tree MAKEEMTPY Operation
//---- public makeEmpty ( ) -----
template
void BST::makeEmtpy ( )
{
// just call private method
makeEmpty ( root );
}
//---- private makeEmpty ( ) ------
template
void BST::
makeEmpty ( BinaryNode * & t )
{
if ( t != NULL )
{
makeEmpty ( t->left );
makeEmpty ( t->right );
delete t;
}
}
Dennis Frey
Last modified: Sun Sep 26 23:41:36 EDT 1999