You are viewing a single comment's thread. Return to all comments →
That's because the question states:
1.The value of every node in a node's left subtree is less than the data value of that node. 2.The value of every node in a node's right subtree is greater than the data value of that node.
1.The value of every node in a node's left subtree is less than the data value of that node.
2.The value of every node in a node's right subtree is greater than the data value of that node.
This means duplicate values are not permitted in a valid tree, so you need to return false if you encounter any.
false
Seems like cookies are disabled on this browser, please enable them to open this website
Is This a Binary Search Tree?
You are viewing a single comment's thread. Return to all comments →
That's because the question states:
This means duplicate values are not permitted in a valid tree, so you need to return
false
if you encounter any.