May 2017
Intermediate to advanced
310 pages
8h 5m
English
A list is clearly a separate concept from a node. So we start by creating a very simple class to hold our list. We will start with a constructor that holds a reference to the very first node in the list. Since this list is initially empty, we will start by setting this reference to None:
class SinglyLinkedList: def __init__(self): self.tail = None