Saturday, 12 April 2014

Find an element in a BST


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

AWS Data Pipeline Services

https://www.youtube.com/watch?v=tykcCf-Zz1M