//Binary Tree - Height balanced tree//

Can i do like this ? is this correct?
Here is the link of my code

yes its an o(n) approach