A Binary Search Tree (BST) must satisfy these rules for every node:
5
/ \
3 8
/ \ / \
1 4 7 9
Check the nodes:
3 < 5, so 3 belongs to the left subtree of 5.8 > 5, so 8 belongs to the right subtree of 5.1 < 3 < 5.4 > 3 but 4 < 5.7 < 8 but 7 > 5.9 > 8 > 5.Every node satisfies the BST rules.
Output: True