rakesh.swarankar
BAN USERstatic boolean checkBST(Node root, int minValue, int maxValue)
{
if(root == null)
return true;
else if( root.data > minValue && root.data < maxValue && checkBST(root.left,minValue,root.data)
&& checkBST(root.right,root.data,maxValue))
return true;
else
return false;
}
static boolean checkBST(Node root) {
if(root == null)
return true;
/* 2nd approach : O(n2)
* else if(isLeftSubtreeLesser(root.left,root.data) && isRightSubtreeGreater(root.right,root.data) && checkBST(root.left) && checkBST(root.right))
return true;*/
// 1st Approach : O(n)
else if(checkBST(root,Integer.MIN_VALUE, Integer.MAX_VALUE))
return true;
else
return false;
}
Reptanyaarriol911, Applications Developer at ABC TECH SUPPORT
I am working as a Data entry Manager and I love my job. Also I love to read new Articles ...
Repjaydkelvey, Accountant at Apkudo
I am 34 years old and live in Houston with my family. I am working as a Human resources consultant ...
RepGlennPCannon, Applications Developer at Techlogix
Hi everyone, I am a professor in Houston, USA. I like to explore new things about Hire Someone To Break ...
Replusinisa67, Secretary at Melbourne
Skilled and experienced secretary in Teiscom company. Highly organized with a strong attention to detail and the ability to monitor ...
Repkrishamoris, Area Sales Manager at Accolite software
I am Krisha , an organized Cosmetology Instructor with 4 years of experience. Successful at keeping detailed records and personalizing lesson ...
RepCeliaParker, teacher at Illinoisstate
Experienced teacher with a background in education who is looking to complement graduate studies with the opportunity to teach at ...
- rakesh.swarankar November 06, 2016