Example (a company structure, calculating the sales of each company):
A
B1 B2
B11 B12 B13 B21 B22 B23
....
Data: B11 (100), B12 (120) B13 (60), B21 (90) B22 (70) B23 (260) Unit: (10,000 yuan)
Requires the total sales of each company, for example:
B1 = B11 B12 B13 = 100 120 60 = 280
B2 = B21 B22 B23 = 90 70 260 = 420
A = B1 B2 = 700
To dynamically calculate
There are many ways to have a number of values in the actual application!
1. Ways that can be summarized step by step
2. Methods can be used (this article)
Note: Use a small amount of code better algorithm to calculate the root node value!
(Until it, to be continued)