|
Binary tree
In Lesson 1, the growth of binary tree depends on two parameters, the scaling factor a and spreading angle . As shown in figure 5, the main trunk of, say, 1 meter gives rise to two shorter branches of (1/a)
meter for the first branching, since a has a value in the range (1.2, 1.8). Also, the tree height is controlled by angle ; that is, the smaller , the taller the binary tree. Now, there are four branches of meter (1/a)
x (1/a)
for the second branching, eight branches of (1/a)
x (1/a)
x (1/a)
meter for the third branching, and so on. Here, we assign the values of aand randomly in a given range.

Figure 5. A binary tree
One random variable: We first fix the spreading angle at = 40 but let a to vary randomly at each stage of branching.
This is coded into Prog#7e by a pseudo-random number generator, which picks a value for a randomly in the range (1.2, 1.8). After running Prog#7e a dozen of times or more, you record in table 5 the number of small, medium, and large binary trees that are observed. Be as objective as possible, though no quantitative measures are provided here for the classification of binary trees.
Table 5. Binary trees
with random scaling factor
Size
|
Small
|
Medium
|
Large
|
Number of Observations
|
|
|
|
Two random variables: Not only the random variation of a in the range (1.2, 1.8), Prog#7f also assigns angle randomly in the range (20°, 60°). Again, after running Prog#7f a dozen of times or more, you record in table 6 the number of small, medium, and large binary trees that are observed.
Table 6. Binary trees
with random scaling factor and angle
Size
|
Small
|
Medium
|
Large
|
Number of Observations
|
|
|
|
Comparing tables 5 and 6, you may notice that there are more or less the same number of small and medium and large binary trees in table 5, whereas more medium binary trees are observed in table 6 than either the small or large ones. This is because randomizing both a and decreases the small and large binary trees by the triangle distribution of figure 3.
Note:
Prog#7e - Prog#7f is available for download on the index page.
If you use a Macintosh, view the Flash versions.
|
[prev] [ 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 ] [next]
back to the lesson
list
|