Validate Binary Search Tree

Example of a binary search tree(BST)
code to validate BST
recursive call till validateBstHelper(12, -2147483647, 16)
recursive call till validateBstHelper(10, -2147483647, 12)
recursive call till validateBstHelper(11, 10, 12)
recursive call till validateBstHelper(11, 10, 12)
Recursive tree after validateBstHelper(10, -2147483647, 12) has returned true
recursive call till validateBstHelper(14, 12, 16)
Recursive tree after validateBstHelper(14, 12, 16) has returned true
Recursive tree after validateBstHelper(12, -2147483647, 16) has returned true
Recursive call till validateBstHelper(20, 16, 2147483647)
Recursive call till validateBstHelper(18, 16, 20)
Recursive call till validateBstHelper(17, 16, 18)
Recursive tree after validateBstHelper(17, 16, 18) has returned true
Recursive tree after validateBstHelper(18, 16, 20) has returned true
Recursive call till validateBstHelper(21, 20, 2147483647)
Recursive tree after validateBstHelper(21, 20, 2147483647) has returned true
Recursive call tree for the whole tree

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store