Data Structures and Algorithms
with Object-Oriented Design Patterns in C# |
The definitions of the methods of the LinkedList.Element class are given in Program . Altogether, there are three methods--a constructor and two properties.
The constructor simply initializes the field to the provided values. Assigning a value to the list, datum and next fields takes a constant amount of time. Therefore, the running time of the constructor is O(1).
The Datum and Next properties provide get accessor methods that simply return the values of the corresponding fields. Clearly, the running times of each of these methods is O(1).