Created
May 11, 2017 08:24
-
-
Save chriswebb09/dadbad2d9ea29f1f1f76abc8e73c1871 to your computer and use it in GitHub Desktop.
LinkedList O(1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func append(value: T) { | |
let newNode = Node(value: value) | |
if let lastNode = last { | |
newNode.previous = lastNode | |
lastNode.next = newNode | |
} else { | |
head = newNode | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment