typedef struct btreenode { Jval key; struct btreenode *left; struct btreenode *right; } BTreeNode; |
Your job is to write a procedure:
int is_bstree(BTreeNode *root, double *min, double *max);
Is_bstree() assumes that it is passed the root of a binary tree, and that the keys are doubles. It returns 1 if the tree is a valid binary search tree, and 0 otherwise. The binary search tree should not have duplicate keys. It also returns the minimum and maximum keys in the tree through the arguments min and max.