Pregunta de entrevista de Google

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