|
Data Structures and Algorithms
with Object-Oriented Design Patterns in Python |
This section presents a linked-list implementation of sorted lists
that is derived from the OrderedListAsLinkedList
class given in Section
.
The SortedListAsLinkedList class
is introduced in Program
.
The SortedListAsLinkedList extends the
OrderedListAsLinkedList class
introduced in Program
and it also extends the abstract SortedList class
defined in Program
.

Program: SortedListAsLinkedList class.
There are no additional instance attributes defined in the SortedListAsLinkedList class. The inherited instance attributes are sufficient to implement a sorted list. In fact, the functionality inherited from the ListAsLinkedList class is almost sufficient--the only method of which the functionality must change is the insert operation.