Amazon interview question

Write a program that balances an unbalanced binary tree.