@@ -0,0 +1,1084 @@
+/*%0A *Key point: binary search%0A *    if there's explicit constructor, the default one isn't available%0A */%0A%0A/**%0A * Definition for binary tree%0A * public class TreeNode %7B%0A *     int val;%0A *     TreeNode left;%0A *     TreeNode right;%0A *     TreeNode(int x) %7B val = x; %7D%0A * %7D%0A */%0Apublic class Solution %7B%0A    public TreeNode sortedArrayToBST(int%5B%5D num) %7B%0A        %0A        int length = num.length;%0A        //handle null pointer and empty array%0A        if(num == null %7C%7C length == 0)%0A            return null;%0A        %0A        return realWorker(num, 0, length - 1);%0A    %7D%0A    %0A    public TreeNode realWorker(int%5B%5D num, int begin, int end)%7B%0A        int mid = (begin + end + 1) / 2;%0A        %0A        //init a new node%0A        TreeNode node = new TreeNode(0);%0A        node.val = num%5Bmid%5D;%0A        %0A        if(begin %3C= mid - 1)%0A            node.left = realWorker(num,begin,mid-1);%0A        else%0A            node.left = null;%0A            %0A        if(mid+1 %3C= end)%0A            node.right = realWorker(num,mid+1,end);%0A        else%0A            node.right = null;%0A            %0A        return node;%0A    %7D%0A%7D

Convert Sorted Array to Binary Search Tree