编译原理(紫龙书)中文第2版习题答案

 主页   资讯   文章   代码   电子书 

Exercises for Section 7.5

7.5.1

What happens to the reference counts of the objects in Fig. 7.19 if:

  1. The pointer from A to B is deleted.
  2. The pointer from X to A is deleted.
  3. The node C is deleted.

A network of objects

Figure 7.19: A network of objects

Answer

  1. The pointer from A to B is deleted.

    7 5 1-1

  2. The pointer from X to A is deleted.

    7 5 1-2

  3. The node C is deleted.

    7 5 1-3

7.5.2

What happens to reference counts when the pointer from A to D in Fig. 7.20 is deleted?

Another network of objects

Figure 7.20: Another network of objects

Answer

7 5 2