512
Graphs and Trees
Figure 6.38
ExamplE 22
A computer virus is spread via e-mail. Each second, 4 new machines are infected.
A 4-ary tree structure (Figure 6.39) represents the spread of the virus. By the
multiplication principle, 4
n
machines have been infected after n seconds.
Figure 6.39
ExamplE 23
Algebraic expressions involving binary operations can be represented by labeled binary trees. The leaves are labeled as operands, and the internal nodes
are labeled as binary operations. For any internal node, the binary operation of
its label is performed on the expressions associated with its left and right subtrees. Thus the binary tree in Figure 6.40 represents the algebraic expression
(2 + x) − ( y * 3).
x y
2
3
*
+
–
Figure 6.40
Practice 19 What is the expression tree for (2 + 3) * 5?
■
Précédent

- 529/986

Suivant