코드 4-6
def add_last(self, data):
new_node = Node(data)
new_node.prev = self.tail.prev
new_node.next = self.tail
self.tail.prev.next = new_node
self.tail.prev = new_node
self.d_size += 1
def insert_after(self, data, node):
new_node = Node(data)
new_node.next = node.next
new_node.prev = node
node.next.prev = new_node
node.next = new_node
self.d_size += 1
def insert_before(self, data, node):
new_node = Node(data)
new_node.prev = node.prev
new_node.next = node
node.prev.next = new_node
node.prev = new_node
self.d_size += 1