树的全部左节点小于根节点,全部右节点大于根节点(不是二叉搜索树)

bool isDUI(TreeNode* root)
{
	if (root == NULL)
		return true;
	bool l = false;
	bool r = false;
	l = isDUI(root->left);
	r = isDUI(root->right);
	bool isOK = true;
	if (root->left != NULL)
		isOK = isOK && (root->left->val < root->val);
	if (root->right != NULL)
		isOK = isOK && (root->right->val > root->val);
	
	if (l&&r&&isOK)
		return true;
	else
		return false;
}