Sample code to find an element in BST:
Tree* lookUp(struct Tree *node, char key)
{
if(node == NULL) return node;
if(node->data == key) return node;
else {
if(node->data < key)
return lookUp(node->right, key) ;
else
return lookUp(node->left, key);
}
}
For other tree operations and complete code refer to : click here
No comments:
Post a Comment