Created
March 8, 2013 16:14
-
-
Save Ray1988/5117584 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TreeNode createminiBST(int arr[], int left, int righ){ | |
if(left> right) return null; | |
int mid= (left+right)/2; | |
TreeNode r=new TreeNode(arr[mid]); | |
r.left=createminiBST(arr, left, mid-1); | |
r.right=createminiBST(arr,mid, righ); | |
return r; | |
} | |
void creatBST(int[] arr){ | |
creatminiBST(arr, 0, arr.length-1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment