Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Deleting nodes from binary search tree

SturbanceSturbance Member Posts: 3
I wrote a binary tree class of which each node holds a string and three integer variables, I can insert a node into the tree, print the tree, search for and print the contents of a node using the string variable, but my delete node function is driving me nuts!!!! i also want to print nodes within a given distance of a specified point.
Can someone please help me in any way???????????

Comments

  • freelance starfreelance star Member Posts: 73
    : I wrote a binary tree class of which each node holds a string and
    : three integer variables, I can insert a node into the tree, print
    : the tree, search for and print the contents of a node using the
    : string variable, but my delete node function is driving me nuts!!!!
    : i also want to print nodes within a given distance of a specified
    : point.
    : Can someone please help me in any way???????????
    :
    Use recursion
    [code]
    if(node == NULL) return;
    if(node->left==NULL) &&(node->right==NULL)
    free node;
    delete(node->left);
    delete(node->right);
    [/code]
    [B][link=http://expert.myitcareer.org/]Freelance Programmer[/link]|[link=http://myitcareer.org/]Interview Question And Answer[/link][/B]
Sign In or Register to comment.