skiing 0 Newbie Poster

I am having problems with the case of removing the node after it has been placed in the correct position in the tree where now I have the same value in two places please help me this is my code. Or is my revision correct.

bool Delete_Node(node_ptr &p, keytype Target)
{
    if(p==null)
        return false;
    else if(p->datum.key<Target)
        return Delete_Node(p->right,Target);
    else if(p->datum.key>Target)
        return Delete_Node(p->left,Target);
    else
    {
        Node_ptr Temp=p;
        if(p->left==null)
        {
            p=p->right;
            delete temp;
            return true;
        }
        else if(p->right==null)
        {
            p=p->left;
            delete temp;
            return true;
        }
        else
        {
            Temp = p->left;
            while(Temp->right!=null){
                Temp=Temp->right;
            }
            p->datum=Temp->datum;
            delete Temp;
            delete(p->left,Target);
        }
    }
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.