Double Linked List: insert_at
This commit is contained in:
parent
e05af4bbf1
commit
a536c5b731
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user