Skip to content

Instantly share code, notes, and snippets.

@chriswebb09
Created May 11, 2017 08:24
Show Gist options
  • Save chriswebb09/dadbad2d9ea29f1f1f76abc8e73c1871 to your computer and use it in GitHub Desktop.
Save chriswebb09/dadbad2d9ea29f1f1f76abc8e73c1871 to your computer and use it in GitHub Desktop.
LinkedList O(1)
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