Implement better arr to tree function that uses recursion to get middle nodes