Link to home
Start Free TrialLog in
Avatar of Aida Behroozian
Aida Behroozian

asked on

sum of leaves in Binary Tree

we have a binary tree in scheme like this  :      (node (leaf 1) (node (leaf 2) (leaf 3)))
we want to calculate sum of  number in leaves

(display (sum '(node (leaf 1) (node (leaf 2) (leaf 3)))))
result => 6
SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial