Data Structures and Algorithms
with Object-Oriented Design Patterns in C#![]() ![]() ![]() ![]() ![]() |
The code for the Enumerator constructor
method is given in Program .
Notice that it uses an instance of the StackAsLinkedList class.
(The linked-list implementation of stacks
is described in Section
).
An empty stack can be created in in constant time.
Therefore, the running time of the constructor is O(1).
Program: AbstractTree Enumerator constructor.