Bloomberg interview question

Write a function that calculates the specific value in a tree.