Data Structures and Algorithms with Object-Oriented Design Patterns in Python
next up previous index

Tree Traversals

 

The abstract Tree class also provides default implementations for two methods called depthFirstTraversal and breadthFirstTraversal. These methods are like the accept method of the container class (see Section gif). Both of these methods perform a traversal. That is, all the nodes of the tree are visited systematically. Both of these implementations access abstract properties, such as key, and call abstract methods, such as and getSubtree. In effect, they are abstract algorithms . An abstract algorithm describes behavior in the absence of implementation!




next up previous index

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