Exemplo n.º 1
0
void BST<T>::postOrderDelete(Node<T>* t) {
  if (t != 0) {
    postOrderDelete(t->getLeftChild());
    postOrderDelete(t->getRightChild());
    delete t;
  }
}
Exemplo n.º 2
0
/* postOrderDelete ***********************************************************************
 *
 * @params: none
 *
 * @modifies: traverse game tree in post order and deletes each node
 *
 * @returns: nothing
 ****************************************************************************************/
void GST::postOrderDelete(GSTNode* node) {
	if (node != nullptr) {
		postOrderDelete(node->childPtr);
		GSTNode* pTemp = node->siblingPtr;
		delete node;
		postOrderDelete(pTemp);
	}
}
Exemplo n.º 3
0
/* clearTree *****************************************************************************
 *
 * @params: none
 *
 * @modifies: calls postOrderDelete to delete game board
 *
 * @returns: nothing
 ****************************************************************************************/
void GST::clearTree() {
	postOrderDelete(root);
}
Exemplo n.º 4
0
BST<T>::~BST() {
  postOrderDelete(root);
}