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.
You can just perform DFS and check if data is in ascending order. No additional data structures/parameters needed. Just one static variable (yep, I am a C programmer :))
Great solution based on the constraints: 0 <= data <= 10^4. This is to utilize BST inorder traversal property. If the data can be min int, then the solution won't work.
Is This a Binary Search Tree?
You are viewing a single comment's thread. Return to all comments →
You can just perform DFS and check if data is in ascending order. No additional data structures/parameters needed. Just one static variable (yep, I am a C programmer :))
Great solution based on the constraints: 0 <= data <= 10^4. This is to utilize BST inorder traversal property. If the data can be min int, then the solution won't work.
This is a wonderful recursive solution.
Wow,,,, How could you tinker this method,, What a brilliant!