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

LinkedList Class __init__ Method

The code for the LinkedList class init method is given in Program gif. Since the instance attributes _head and _tail are set to None, the list is empty by default. The running time of the __init__ method is clearly constant. That is, T(n)=O(1).

   program3835
Program: LinkedList class __init__ method.


next up previous index

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