defsplit(self, x):
tail=self.head.prev# 기존 리스트 분리 후 양 끝단 연결x.prev=self.headself.head.prev=x.prev# 분리된 리스트를 새로운 리스트로 만들어준다new_doublylinkedlist=DoublyLinkedList()
new_doublylinkedlist.head.next=x.nextx.next.prev=new_doublylinkedlist.headnew_doublylinkedlist.head.prev=tailtail.next=new_doublylinkedlist.head# size 조정은 아래로
size 수정 방법 (미해결)
각 리스트 안 노드의 개수가 몇 개 인지 찾은 다음에 빼기 혹은 더하기. → w.c에 따르면 O(n)이 된다