i need a optimal tree balancing algorithm.
for example:

12
/ \
9 20
/ \ / ...