Data Structures and Algorithms
with Object-Oriented Design Patterns in C# |
The FindPosition method of the OrderedListAsLinkedList class is used to determine the position of an item in an ordered list implemented as a linked list. Its result is an instance of the inner class MyCursor. The FindPosition method is defined in Program
Program: OrderedListAsLinkedList class FindPosition method
The FindPosition method takes as its argument a ComparableObject that is the target of the search. The search algorithm used by FindPosition is identical to that of Find, which is given in Program . Consequently, the running time is the same: , where is the time required to match two ComparableObjects, and is the number of items in the ordered list.