方法一: 中序遍历
#include <stdio.h>
typedef struct _node{
struct _node *left, *right;
int data;
}node;
int helper(node *left, node *root, node *right){
if(root == NULL)
return 1;
if(left != NULL && helper(left->left, left, left->right)==0)
return 0;
if(right != NULL && helper(right->left, right, right->right)==0)
return 0;
if(left->data>root->data || root->data<right->data)
return 0;
}
方法二: 取出左右子树最值,与根节点比较