Group Group Group Group Group Group Group Group Group

Errata for Data Structures and Algorithms in Swift, 3rd Edition

The official errata thread for Data Structures and Algorithms, 3rd edition!

Loving the book so far, thank you!
Here are some corrections needed in Chapter 6, Linked List code on page 83:

private mutating func copyNodes(returningCopyOf node: Node?) -> Node? {
guard !isKnownUniquelyReferenced(&head) else {
return node // The book has a nil here, so appending to uniquely referenced lists does not work
guard var oldNode = head else {
return nil
head = Node(value: oldNode.value)
var newNode = head
var nodeCopy: Node?
while let nextOldNode = {
if oldNode === node {
nodeCopy = newNode
newNode!.next = Node(value: nextOldNode.value)
newNode = newNode!.next
oldNode = nextOldNode
tail = newNode // Updating the tail is missing in the book
return nodeCopy


I found the book to be minimally helpful. It had minimal insight and minimal explanations of the algorithms. It would have been better to have less examples and more detail. I mean just try too decipher this:
extension LinkedList {
mutating func reverse() {
tail = head // reassign head to tail position
var prev = head
var current = head?.next
prev?.next = nil

  while current != nil {
    let next = current?.next
    current?.next = prev
    prev = current
    current = next


The naming system of the variables leaves a lot to be desired and is very confusing. I have 3 apps on the app store and have been doing IOS for 3 years. The video and articles are way more clearer on the website. This book feels rushed.

@ingo69 Thank you for your feedback - much appreciated!