Skip to content

Commit

Permalink
Merge pull request kodecocodes#589 from khuong291/master
Browse files Browse the repository at this point in the history
Update reverse function in LinkedList
  • Loading branch information
kelvinlauKL authored Aug 25, 2017
2 parents eb7ec32 + aa900e3 commit 665b526
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Linked List/README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ How about reversing a list, so that the head becomes the tail and vice versa? Th
```swift
public func reverse() {
var node = head
tail = node // If you had a tail pointer
while let currentNode = node {
node = currentNode.next
swap(&currentNode.next, &currentNode.previous)
Expand Down

0 comments on commit 665b526

Please sign in to comment.