# Binary Search Tree Check

## The question

Given a binary tree, check whether it’s a binary search tree or not.

## My solution

I cheated a little in this question because I didn’t remember what a binary search tree is. After checking wikipedia I found the characteristic of a BST:

– The left subtree of a node contains only nodes with keys less than the node’s key.

– The right subtree of a node contains only nodes with keys greater than the node’s key.

– The left and right subtree each must also be a binary search tree.

– Each node can have up to two successor nodes.

– There must be no duplicate nodes.