Zambola
BAN USER
Comments (4)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
boolean isBst(Node n, int min, int max) {
if(n == null) return true;
if( n.data <= max || n.data > min) return false;
else return ( isBst(n.left, min, n.data) |&&
isBst(n.right, n.data, max));
}
first call will be isBst(root, -sentinel, sentinel); // sentinel = largest possible value.
Comment hidden because of low score. Click to expand.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
- Zambola February 02, 2018