Egencia interview question

Basic binary tree coding question