@@ -0,0 +1,660 @@
+%0Apublic class ConvertSortedArrayToBinarySearchTree %7B%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09// TODO Auto-generated method stub%0A%0A%09%7D%0A%09%0A%09private class TreeNode %7B%0A%09%09int val;%0A%09%09TreeNode left;%0A%09%09TreeNode right;%0A%09%09TreeNode(int x) %7B val = x; %7D%0A%09%7D%0A%09%0A%09public TreeNode sortedArrayToBST(int %5B%5D nums) %7B%0A%09%09if(nums.length == 0) return null;%0A%09%09%0A%09%09TreeNode head = helper(nums,0,nums.length-1);%0A%09%09return head;%0A%09%7D%0A%09%0A%09private TreeNode helper(int nums%5B%5D,int low,int high) %7B%0A%09%09if(low %3E high) return null;%0A%09%09int mid = (low + high) / 2;%0A%09%09TreeNode node = new TreeNode(nums%5Bmid%5D);%0A%09%09node.left = helper(nums,low,mid-1);%0A%09%09node.right = helper(nums,mid+1,high);%0A%09%09return node;%0A%09%7D%0A%7D%0A

108. Convert Sorted Array to Binary Search Tree