LG Electronics interview question

implement binary tree