Cognizant interview question

I was asked to write code for Binary Tree.