Google interview question

Write an algorithm that checks if a binary tree is balanced, improve it and determine its complexity.