RosettaCodeData/Task/Doubly-linked-list-Element-insertion/Python/doubly-linked-list-element-insertion.py
2023-07-01 13:44:08 -04:00

5 lines
123 B
Python

def insert(anchor, new):
new.next = anchor.next
new.prev = anchor
anchor.next.prev = new
anchor.next = new