Last active
May 24, 2018 02:21
-
-
Save reyou/bff0cc54eff8775a8e75ab241cf1be74 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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