build a binary tree from a sorted array