In v0.9.1, p.99, the “post-swap” diagram has minor mistake: remove dotted line & add solid line between node 27 and 37.
I guess the text on p.98 also is not clear (or is inferred) that once node 27 is swapped into place of deleted node 25, the left and right children (12 and 37) still need to be re-connected to 27 (which originally had no children).
Oh, wait, I see; upon further reading of the code on p.100, I realize now that the swap does not really refer to the node, but rather the node.value.
I think this sentence on p. 98 led me astray:
When removing a node with two children, replace the node you removed with smallest
node in its right subtree.
I would suggest clarifying that to be specific about the node.value; i.e.
When removing a node with two children, replace the value of that node [to be removed] with the
value of the smallest node in its right subtree.
The diagram on p. 98 does mention “Replaced value” but then that diagram also has the relationship lines marked incorrectly.
I got the 1.0 release today, thank you for that. I’ve found a couple of minor issues though.
The .pdf version of the book does not have any Table of Contents. This makes it difficult to navigate back and forth between the end of the book to check the Challenge answers and back to where you were reading.
The printed ToC is not linked for easy navigation.
The Chapter 4 Linked List Challenge Starter Playground’s Render Documentation option is turned off which disables paging through the Challenge. I have not checked any of the other challenge playgrounds so I can’t say if it is a problem throughout.
Like I said, minor issues but I thought you’d like to know so they can be fixed for the next release.
The table of contents issue is known and it’s a problem with the tool we’re using to render the PDF files. As far as I know, this issue is persisting in other books as well. We’ve backlogged it as a TODO…
Thanks again. I would like to suggest that the start of each chapter include “Chapter n” along with the chapter title just to make clear a new chapter is being started.
In Chapter 13: Binary Search Trees on pages 115 & 116 are the illustrations correct? They still show the imaginary 3rd link from the root to node 37 from the illustration showing the potential problems with removal. Since those 2 illustrations are now back in the real world of how the removal actually works, shouldn’t the link from node 37 be to the node being removed/updated? This is particularly true of the page 116 illustration showing the finished tree.
Also, there is a difference between the pdf and the ePub versions. On page 109 of the pdf there is a list of 3 steps explaining code we just entered. In the ePub version (I’m showing page 158) the list is numbered
There is a blue line in the middle of the matrix. When the row and column are equal, this represents an edge between a vertex and itself, which is not allowed .
Binary Search Tree Challenges (Third Edition: page 176)
Solutions to Challenge 1:
Blockquote
A binary search tree is a tree where every left child is less than or equal to its parent, and every right child is greater than its parent.
It should’ve said:
Blockquote
A binary search tree is a tree where every left child is less than to its parent and every right child is greater than or equal than its parent.
Also on the same page, on the actual code:
if let min = min, tree.value < min {
return false
} else if let max = max, tree.value >= max {
return false
}