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

Constructor

The code for the Enumerator constructor method is given in Program gif. Notice that it uses an instance of the StackAsLinkedList class. (The linked-list implementation of stacks is described in Section gif). An empty stack can be created in in constant time. Therefore, the running time of the constructor is O(1).

   program15753
Program: AbstractTree Enumerator constructor.


next up previous contents index

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