adding solutions for tree recursion problems