RosettaCodeData/Task/Doubly-linked-list-Element-insertion/Python/doubly-linked-list-element-insertion.py

6 lines
123 B
Python
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
def insert(anchor, new):
new.next = anchor.next
new.prev = anchor
anchor.next.prev = new
anchor.next = new