void Delete(TreeNode* tree, ItemType item)
	 {
			
		 
		 if (item.ComparedTo (tree->info)==LESS)
    		Delete(tree->left, item);   
		 else if (item.ComparedTo( tree->info)==GREATER)
    		Delete(tree->right, item);  
  	else
    		DeleteNode(tree);  // Node found
	} 

		
	 void GetPredecessor(TreeNode* tree,  ItemType& data) 
  // Sets data to the info member of the right-most node in tree.
{
	while (tree->right != NULL)
   		tree = tree->right;
  		data = tree->info;
}

	 void DeleteNode(TreeNode* tree)
	 {	

		  TreeNode* tempPtr;
		  tempPtr = tree;
		  if(tree->left == NULL&&tree->right==NULL)
			 delete tempPtr;
		  else if (tree->left == NULL) 
		  {
			tree = tree->right;
			delete tempPtr;
		  }
		  else if (tree->right == NULL)
		  {
			tree = tree->left;
			delete tempPtr;
		  }

			else
		 {
			GetPredecessor(tree->left, item);
			tree->info =item;
			Delete(tree->left, item);
		  }
	  }

so when i was delete the leaf don't work
so what can i do
with my regardes

Hmm, I think this might be a good read for you.

I was try this code and doesn't work
thanx noura :)

Perhaps I was too subtle. Please allow me to try again.

[take 2]
Your code is wrong. It has very basic mistakes. You lack fundamentals. Read the tutorial, dammit.
[/take 2]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.