Skip to content

Commit 22e4496

Browse files
Fixed issue in LinkedList insert(_:, at:) method where next?.previous was referencing next itself.
1 parent 7448846 commit 22e4496

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Linked List/LinkedList.playground/Contents.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public final class LinkedList<T> {
176176
list.head?.previous = prev
177177

178178
list.last?.next = next
179-
next?.previous = list.last?.next
179+
next?.previous = list.last
180180
}
181181
}
182182

Linked List/LinkedList.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public final class LinkedList<T> {
166166
list.head?.previous = prev
167167

168168
list.last?.next = next
169-
next?.previous = list.last?.next
169+
next?.previous = list.last
170170
}
171171
}
172172

0 commit comments

Comments
 (0)