We are given
struct NodeProp {
  int id;
  int parent_id;
  int weight;
};

Example:
100 {parent_id: -1, weight: 5}
|
10 {parent_id: 100, weight: 3}
|
5 {parent_id: 10, weight: 2}

We have to print the sum of weights for each id

For example if the id=5 parent_id- 10 and weight = 4 then id = 10 weight
should be 7
and 100 should be 12

What is the best data structure to use for the above and how do we proceed
for the solution?

-
Azhar.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.

Reply via email to