I have objects in a tree structure, I would like to aggregate status information from child nodes and update the parent node with aggregated status. Suppose node A has children B1, B2 and B1 has C1, C2, C3 as children. Each of the nodes has a status attribute.
Now, if C1, C2, C3 are completely full, I would like to mark B1 as completed. And if C4, C5, C6, C7 are complete, make B2 complete. When B1 and B2 are completed as full label A.
I can use these nodes in brute force method and make updates, can someone suggest an efficient algorithm for this.
A {B1 {C1, C2, C3}, Bi 2 {C4, C5, C6, C7}}
source
share