All pastes #101918 Raw Edit

Stuff

public cpp v1 · immutable
#101918 ·published 2006-07-27 06:49 UTC
rendered paste body
HERE IS DELETEin the class def, make one changeafter:     void printTree(); put:     void deleteInfo(char *searchArg);Put this stuff somewhere before main()://recursively go through the tree and readd everything exceptContactInfo *x =//for the node we want to remove.. quick and ditry deletevoid addInfo(TreeNode *x, BinSearchTree *n, char * searchArg){       if(NULL != x)  {              addInfo(x->getLeftChild(),n,searchArg);    if(0 != strcmp(x->getSearchKey(),searchArg))    	n->insertNode(x->getSearchKey(),x->getInfo());	addInfo(x->getRightChild(),n,searchArg); 	delete x;  }}void BinSearchTree::deleteInfo(char *searchArg){  BinSearchTree *newTree;  newTree = new BinSearchTree;  addInfo(root_ptr,newTree,searchArg);  root_ptr = newTree->root_ptr;}//to delete josh from the names listnames.deleteInfo("Josh");//you will have to delete from both lists... so just call findInfonames.deleteInfo("Josh");ContactInfo *x = names.findInfo("Josh");numbers.deleteInfo(x->getNumber());//visa versa for the other way...