Double Linked List: insert_at
This commit is contained in:
parent
e05af4bbf1
commit
a536c5b731
@ -128,9 +128,12 @@ class DoubleLinkedList(V)
|
|||||||
i += 1
|
i += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
new_node.next = current.next
|
new_node.next = current
|
||||||
current.next = new_node
|
new_node.previous = current.previous
|
||||||
new_node.previous = current
|
|
||||||
|
current.previous.not_nil!.next = new_node
|
||||||
|
current.previous = new_node
|
||||||
|
|
||||||
@size += 1
|
@size += 1
|
||||||
new_node
|
new_node
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user