Pergunta de entrevista da empresa National Instruments

Write an algorithm to find the average of all values stored in a given binary tree.