Computer Science, asked by tushitagalbatross, 1 month ago

Tomorrow is Kerry's birthday. Jim is planning to gift her a
rooted tree with n nodes. Nodes are numbered from 1 to
n, rooted at node 1. Every node has a cost associated
with it and a color either black or white. It's been years
and Jim know exactly what combination of colors Kerry
will love. So, he knows which target color (Black/White)
every node should have at the end.
To do so, he can perform the following operation any
number of times:
Select any node p except a leaf node, and swap colors
of any two nodes in the subtree of node p. This
operation costs equal to the cost associated with the
node p.
ght
He wants that after performing such operations every
node finally has the color corresponding to its target.
Rules
Help him find out the minimum total cost for such
operations after which every node has the corresponding
target color, or find out if that is impossible.​

Answers

Answered by mrudulatha29
0

Answer:

hey is this a question

it is very different

Similar questions