Write a program that verifies that a binary tree is a binary search tree.
Anonymous
Let the BinaryTree contain 3 variables: value, leftChild, rightChild. The leftChild and the rightChild are again type of BinaryTree only. Now say you are given root node as the argument. At every stage, check if the value of the leftChild is less than current node value which is less than value of rightChild. If it is satisfied, recurse through its children. Otherwise, return "Not a Binary Search Tree"
Check out your Company Bowl for anonymous work chats.