Problem :
Consider A tree, such that root node is made black first and then its child nodes in next step and so on. In each step you can make one node as white node. Any node which is made white will prevent itself and its decendent node from becoming black.
Eg If root has two child, and it is black at start, in next step it can make its child node as black but you can prevent complete subtree of one child node by making it white.
The problem is to tell if the a given set of special nodes can be prevented from becoming black.
Constraint : any node can have atmost 2 child.
solution
a) Find a path from root to any leaf node which has no special node on the path and leaf node is not a special node. If such path exist, it possible else not
b) consider a function f(v) which is true if and only if subtree rooted at node v can be saved when v is made black and none of its child node are black.
f(V) = false, if v is special node
= true , if v is not special node and v is leaf node
= true, if v has atmost 1 child
= f(u) | f(w) , u and w are child node of v
Consider A tree, such that root node is made black first and then its child nodes in next step and so on. In each step you can make one node as white node. Any node which is made white will prevent itself and its decendent node from becoming black.
Eg If root has two child, and it is black at start, in next step it can make its child node as black but you can prevent complete subtree of one child node by making it white.
The problem is to tell if the a given set of special nodes can be prevented from becoming black.
Constraint : any node can have atmost 2 child.
solution
a) Find a path from root to any leaf node which has no special node on the path and leaf node is not a special node. If such path exist, it possible else not
b) consider a function f(v) which is true if and only if subtree rooted at node v can be saved when v is made black and none of its child node are black.
f(V) = false, if v is special node
= true , if v is not special node and v is leaf node
= true, if v has atmost 1 child
= f(u) | f(w) , u and w are child node of v