My previous question is actually not a very difficult problem to solve if you sit down to analyze for a while. Forget that question for a while. I will ask it again when the time comes. What I am going to do in this thread is to take you towards understanding a difficult problem progressively! SO I am waiting for your answers to take you to the next level! We will end up solving a problem for parallel processing. So algorithm freaks here we go
Suppose you are given any tree.
All you have to do is what is known as upward accumulation! For the ease of understanding lets take addition as the operation. So, every leaf node in the tree is given a weight.
1. The accumulation at leaf node is nothing but the weight of the node itself.
2. The accumulation at every other node is the sum of weights of all nodes in its subtree for which it is the root!
A solution to this is very easy! I am expecting the answer soon. No need of giving me an implementation. Just share your idea
. First lets start with a uni-processor system!
Last edited by indranil on Mon Apr 26, 2010 7:52 am; edited 1 time in total (Reason for editing : grammar)