Skip to content

Instantly share code, notes, and snippets.

@reyou
Last active May 24, 2018 02:21
Show Gist options
  • Save reyou/bff0cc54eff8775a8e75ab241cf1be74 to your computer and use it in GitHub Desktop.
Save reyou/bff0cc54eff8775a8e75ab241cf1be74 to your computer and use it in GitHub Desktop.
struct BstNode
{
int data;
BstNode *left;
BstNode *right;
};
int FindMin(BstNode *root)
{
if (root == NULL)
{
cout << "Error: Tree is empty\n";
return -1;
}
else if (root->left == NULL)
{
return root->data;
}
// Search in left subtree.
return FindMin(root->left);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment