recursive implementation of determine balanced binary tree