NVIDIA interview question

I was asked to write a function for Binary tree.