We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Trees: Is This a Binary Search Tree?
- Discussions
Trees: Is This a Binary Search Tree?
Trees: Is This a Binary Search Tree?
Sort by
recency
|
802 Discussions
|
Please Login in order to post a comment
include // for INT_MIN and INT_MAX
// Helper function to check the BST condition bool checkBSTUtil(Node* root, long long minVal, long long maxVal) { // Base case: If the node is null, it's a valid BST by definition if (root == nullptr) { return true; }
}
// Function to check if a tree is a BST bool checkBST(Node* root) { return checkBSTUtil(root, LONG_MIN, LONG_MAX); }
C# bugged as well. There's no internal methods to process the BST so, if we do it ourselves is going to be properly constructed in all cases, but then it will fail the test cases.
C# bugged as well. There's no internal methods to process the BST so, if we do it ourselves is going to be properly constructed in all cases, but then it will fail the test cases.
C# bugged as well. There's no internal methods to process the BST so, if we do it ourselves is going to be properly constructed in all cases, but then it will fail the test cases.
This exercise has no Swift stubs and there is no way of knowing how it's suppose to create the invalid binary search trees with the provided input values.