Question: How to verify whether a binary tree is a binary search tree?
For example, the tree in Figure 1 is a binary search tree.
Figure 1: A binary search tree |
A node in binary tree is defined as:
struct BinaryTreeNode
{
int nValue;
BinaryTreeNode* pLeft;
BinaryTreeNode* pRight;
};