What is the difference between these constructors for a LinkedList, why is one better or worse than the other?
class Node:
def __init__(self, data):
self.data = data
self.next = None
class Singly_Linked_List:
def __init__(self):
self.head = None
versus:
class Singly_Linked_List:
def __init__(self):
self.head = Node(0)
Does this affect how the SLL or DLL would be implemented for the addAtIndex, removeAtIndex functions for example?