i need some help with this problem.
I have a binary tree stucture which shows all paths between 2 nodes "1" and "10" as shown in the diagram. and the interconnections between the node(i.e. edges) have certain weights.
Now can anybody sugest me an algorithm or a flow as to how to calculate the following.
now let us take paths from "1" to "10" "a) 1 to 2 to 3 to 10" "b) 1 to 2 to 4 to 8 to 10" "c)1 to 2 to 4 to 7 to 10 etc"
now the way the calculation is done is liek a series/parallel circuit.
wherevr the node branches into 2 I need to calculate the series resistance values
for example if i just consider two paths" a) 1 to 2 to 3 to 10 and 1 to 2 to 4 to 8 to 10"
we can see that there is a branch at 2 .. so i add all edge values from" 2 to 3 to 10" and "2 to 4 to 8 to 10 "and then multiply these two sums and then add value from "1 to 2" to get the overall value.
this has to be done over the entire tree.. any ideas as to how to go about implimenting this in C ??
Image can be found here : https://i.stack.imgur.com/PlXiT.png