time optimization on balanced-binary-tree