Solution:
#include<stdio.h>
struct binarysearchtree
{
int data;
struct binarysearchtree* left;
struct binarysearchtree* right;
};
typedef struct binarysearchtree* tree;
tree min(tree T)
{
if (T==NULL)
return NULL;
else
{
if(T->left==NULL)
return T;
else
return min(T->left);
}
}
Click Here For More Questions
I see a simpler solution here. Use iteration to find the lowest tree point.
ReplyDeleteint minTree(tree t){
while (t.left != null)
t = t.left;
return t.data;
}