class LLNode:
’’’Node to be used in linked list
nxt: LLNode -- next node
None iff we’re at end of list
value: object --- data for current node
’’’
def __init__(self, value, nxt=None):
’’’ (LLNode, object, LLNode) -> NoneType
Create LLNode (self) with data value and successor nxt.
’’’
self.value, self.nxt = value, nxt
class LinkedList:
’’’Collection of LLNodes
front: LLNode -- front of list
back: LLNode -- back of list’’’
def __init__(self):
’’’ (LinkedList) -> NoneType
Create an empty linked list. ’’’ self.front, self.back = None, None self.size = 0
The process of LL looks like the process of bubble sort. We need to use the while loop to control the program to find the node that we want to delete or insert.
We don't have lab this week since the strike.
没有评论:
发表评论