Double Linked List: insert_at

This commit is contained in:
Philippe PITTOLI 2024-05-26 00:36:46 +02:00
parent e05af4bbf1
commit a536c5b731

View File

@ -128,9 +128,12 @@ class DoubleLinkedList(V)
i += 1
end
new_node.next = current.next
current.next = new_node
new_node.previous = current
new_node.next = current
new_node.previous = current.previous
current.previous.not_nil!.next = new_node
current.previous = new_node
@size += 1
new_node
end