TreeNode createMinimalBST(int arr[], int start, int end)

{
if (end < start)
{
return null;
}
int mid = start + (end - start) / 2;
TreeNode n=new TreeNode(arr[mid]);
n.left=createMinimalBST(arr,start,mid-1);
n.right=createMinimalBST(arr,mid+1,end);
return n;
}
TreeNode createMinimalBST(int array[])
{
return createMinimalBST(array,0,array.length-1);
}

posted on 2017-05-20 16:24  lxjshuju  阅读(244)  评论(0编辑  收藏  举报