Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
public TreeNode sortedArrayToBST(int[] num) {
TreeNode node = sortedArrayToBST(num, 0, num.length-1);
return node;
}
public TreeNode sortedArrayToBST(int[] num, int start, int end) {
if (start>end) return null;
int middle = start + (end-start)/2;
TreeNode node = new TreeNode(num[middle]);
node.left = sortedArrayToBST(num, start, middle-1);
node.right = sortedArrayToBST(num, middle+1, end);
return node;
}