Question

Design a recursive algorithm with proofs of the following: Richest Heritage: Input: A binary tree T...

Design a recursive algorithm with proofs of the following:

Richest Heritage:

Input: A binary tree T in which each node x contains a field worth[x], which is a (positive, zero, or negative) monetary value expressed as a real number.

Define (monetary) heritageof a node x to be the total worth of ancestors of x minus the total worth of proper descendants of x.

Output: A node x in T with maximum heritage

Note: other than the field worthand left/right child pointers, nodes of the given tree do not have any additional fields that you may use to store computed values. You are not allowed to alter the content of any nodeor create a “working copy” of the tree.]

Homework Answers

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions