Hi guys, how can I write a simple program which returns true if the given binary tree is binary search tree and false otherwise...
This is a discussion on Binary Search Tree within the C Programming forums, part of the General Programming Boards category; Hi guys, how can I write a simple program which returns true if the given binary tree is binary search ...
Hi guys, how can I write a simple program which returns true if the given binary tree is binary search tree and false otherwise...
Recursion! Look at the current node. If there are no children, return true. If there are child nodes, then depending on if it is a left or right child, the value contained in that child should either be less-than or greater-than the current node's value. If not what you expected, then return false otherwise you then need to recurse through those children.
I used to be an adventurer like you... then I took an arrow to the knee.
Thanks for your reply...