|
Data Structures and Algorithms
with Object-Oriented Design Patterns in Python |
The code for the LinkedList class init method
is given in Program
.
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).

Program: LinkedList class __init__ method.