Originally Posted by
brewbuck
Take the middle element of the sorted array. This will be the root of the tree. Take everything left of this middle element and construct a balanced tree from it, and make this the left subtree. Same for the right. Recursive implementation is just a few lines.
If the data is already sorted, there is no need to make a tree out of it. Just do binary search.
Is this for an assignment? If not, you're making things harder than they need to be. The height of ANY balanced tree of N nodes is simply floor(log2(N))+1.