Correctly builds BST from sorted array

Tested with only small instances though (n should be a power of 2 - 1).