Pergunta de entrevista da empresa SAP

Binary tree was part of it