Balanced binary tree solved