Singly linked list class

A list is a separate concept from a node. We start by creating a very simple class to hold our list. We start with a constructor that holds a reference to the very first node in the list (that is tail in the following code). Since this list is initially empty, we will start by setting this reference to None:

class SinglyLinkedList:
def __init__ (self):
self.tail = None
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset