class Node(object):
def __init__(self, data):
self.data = data
self.next = None
Why is it still better to create a seperate SinglyLinkedList class, as below, rather than just constructing the link list directly from the objects of the Node class?
class SinglyLinkedList:
def __init__(self):
self.first = None
def append(self, data):
node = Node(data)
if self.first == None:
self.first = node
else:
current = self.first
while current.next:
current = current.next
current.next = node
class Node(object):
def __init__(self, data):
self.data = data
self.next = None
Why is it still better to create a seperate SinglyLinkedList class, as below, rather than just constructing the link list directly from the objects of the Node class?
class SinglyLinkedList:
def __init__(self):
self.first = None
def append(self, data):
node = Node(data)
if self.first == None:
self.first = node
else:
current = self.first
while current.next:
current = current.next
current.next = node
class Node(object):
def __init__(self, data):
self.data = data
self.next = None
Why is it still better to create a seperate SinglyLinkedList class, as below, rather than just constructing the link list directly from the objects of the Node class?
class SinglyLinkedList:
def __init__(self):
self.first = None
def append(self, data):
node = Node(data)
if self.first == None:
self.first = node
else:
current = self.first
while current.next:
current = current.next
current.next = node
status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|
repetition number in this series | 0 | memorised on | scheduled repetition | ||||
scheduled repetition interval | last repetition or drill |