Cover Data Structures and Algorithms with Object-Oriented Design Patterns in Java
next up previous contents index

Alternate Representations for Trees

Figure gif shows an alternate representation of the tree tex2html_wrap_inline62306 defined in Equation gif. In this case, the tree is represented as a set of nested regions in the plane. In fact, what we have is a Venn diagram  which corresponds to the view that a tree is a set of sets.

   figure14374
Figure: An alternate graphical representation for trees.

This hierarchical, set-within-a-set view of trees is also evoked by considering the nested structure of computer programs. For example, consider the following fragment of Java code:

class D {
    class E {
	class F {
	}
    }
    class G {
	class H {
	    class I {}
	}
	class J {
	    class K {}
	    class L {}
	}
	class M {}
    }
}
The nesting structure of this program and the tree given in Equation gif are isomorphic .gif Therefore, it is not surprising that trees have an important role in the analysis and translation of computer programs.


next up previous contents index

Bruno Copyright © 1998 by Bruno R. Preiss, P.Eng. All rights reserved.