cpp implementation of Balanced Binary Tree