Given a binary tree, check if it is a binary search tree?
A binary search tree (BST) is a binary tree where each node has a value such that:

- The value stored in the left subtree of a node must be less than the value of the node.
- The value stored in the right subtree of a node must be greater than or equal to the value of the node.
- Both left and right subtrees must also be binary search trees.

To check if a binary tree is a binary search tree, you can perform an in-order traversal of the tree and store the values in a list. The in-order traversal of a BST produces the values in the sorted order. So if the list is sorted in ascending order, then the binary tree is a BST. Otherwise, it is not.

Here’s how you can implement the above approach in Python:

```python
def isBST(tree):
    def in_order_traverse(tree, values):
        if tree is not None:
            in_order_traverse(tree.left, values)
            values.append(tree.val)
            in_order_traverse(tree.right, values)

    values = []
    in_order_traverse(tree, values)
    return all(values[i] <= values[i + 1] for i in range(len(values) - 1))
```

Another approach is to recursively check each node with its left and right child. This way you don’t need to store the values in a list. Here’s how you can implement this in Python:

```python
def isBST(tree):
    def is_bst_helper(tree, min_value=float('-inf'), max_value=float('inf')):
        if tree is None:
            return True
        if not min_value <= tree.val <= max_value:
            return False
        return is_bst_helper(tree.left, min_value, tree.val) and is_bst_helper(tree.right, tree.val, max_value)

    return is_bst_helper(tree)
```
Below is an instruction that describes a task, write a response that appropriately completes the request.

### Instruction:
Given a binary tree, check if it is a binary search tree?

### Response:
A binary search tree (BST) is a binary tree where each node has a value such that:

- The value stored in the left subtree of a node must be less than the value of the node.
- The value stored in the right subtree of a node must be greater than or equal to the value of the node.
- Both left and right subtrees must also be binary search trees.

To check if a binary tree is a binary search tree, you can perform an in-order traversal of the tree and store the values in a list. The in-order traversal of a BST produces the values in the sorted order. So if the list is sorted in ascending order, then the binary tree is a BST. Otherwise, it is not.

Here’s how you can implement the above approach in Python:

```python
def isBST(tree):
    def in_order_traverse(tree, values):
        if tree is not None:
            in_order_traverse(tree.left, values)
            values.append(tree.val)
            in_order_traverse(tree.right, values)

    values = []
    in_order_traverse(tree, values)
    return all(values[i] <= values[i + 1] for i in range(len(values) - 1))
```

Another approach is to recursively check each node with its left and right child. This way you don’t need to store the values in a list. Here’s how you can implement this in Python:

```python
def isBST(tree):
    def is_bst_helper(tree, min_value=float('-inf'), max_value=float('inf')):
        if tree is None:
            return True
        if not min_value <= tree.val <= max_value:
            return False
        return is_bst_helper(tree.left, min_value, tree.val) and is_bst_helper(tree.right, tree.val, max_value)

    return is_bst_helper(tree)
```