Beispiel #1
0
void AVL<T>::clearHelper(Node* rt){
	if(rt->right != NULL)
		clearHelper(rt->right);
	if(rt->left != NULL)
		clearHelper(rt->left);
	delete rt;
}
void BinarySearchTree<Key, Value>::clearHelper(
		BinaryTreeNode<Key, Value>* subRoot)
{
	if (subRoot == NULL)
	{
		return;
	}
	else
	{
		clearHelper(subRoot->leftChild());
		clearHelper(subRoot->rightChild());
		delete subRoot;
	}
}
void BSTree<DataType, KeyType>::clearHelper(BSTreeNode* &parent)
{
   if(parent == NULL)
   {
      return;
   }
   if(parent->right != NULL)
   {
      clearHelper(parent->right);
   }
   if(parent->left != NULL)
   {
      clearHelper(parent->left);
   }
   delete parent;
   parent = NULL;
}
Beispiel #4
0
void HashTable::clearHelper(Node* src)
{
	delete src->customerInfo;
	src->customerInfo = NULL; 

	if(src->next != NULL)
	{
	   clearHelper(src->next);
	}

	delete src;
	src = NULL; 
}
Beispiel #5
0
void HashTable::clear()
{
	for(int i = 0; i <= MAX_BUCKETS ; i++)
	{
		if(table[i]->next != NULL)
		{
			clearHelper(table[i]->next);
		}
		
		if(table[i]->customerInfo != NULL)
		{ 
			delete table[i]->customerInfo; 
		} 

		delete table[i];
		table[i] = NULL; 
	}
}
Beispiel #6
0
void AVL<T>::clear(){
	clearHelper(root);
	root = NULL;
	numNodes = 0;
}
void BSTree<DataType, KeyType>::clear()
{
   clearHelper(root);
}