The first step of the algorithm processes all the leaves and if the salary is known, propagates its salary to its parent. Continue this process all the way to the root and if the salary is unknown, but all the children in the tree are known, calculate the salary and continue. In the second step we need to propagate back down in the case when an ancestor in the three is known and can result in deducing the salary. Start at the root, and do the following, if the salary is known and at most one of the children are unknown, calculate its salary and recurse on all children. If the current node salary is unknown or two or more childrens salary is unknown, halt and print error message.