Errata for Data Structures and Algorithms in Kotlin 1st Edition

Creating this topic to catch any typos and bugs in the 1st Edition of Data Structures and Algorithms in Kotlin.

I have bought printed version for 60 dollars and to be honest i have found there quite a lot mistakes and some typos, but what disappointed me the most that the source code link is dead and you have nothing on your github…

How is this even possible?

Link from book:

www.raywenderlich.com/store/data-structures-and-algorithms-in-kotlin-source-code/

Hello, @kebabkrabby,

Thank you for reaching out regarding this book.

Firstly, I apologize for any mistakes that slipped through our editorial process! We’d love to hear any examples or feedback so we can them fixed up in the next update.

Additionally, here is the correct source code link: https://store.raywenderlich.com/products/data-structures-and-algorithms-in-kotlin-source-code

It seems the word “products” was switched out for “store.” I will get the frontmatter of the book updated ASAP to Amazon.

Regarding the GitHub, we don’t traditionally store materials there for the book.

Thank you, again. Please let me know if you have any further issues accessing the materials!

Best,
Manda
Managing Editor

1 Like

Errata for Chapter 10

the remove function has a couple of minor mistakes such as CollectionType should be List.
Here is the correct version:

fun remove(collection: List<Key>) {
        // 1
        var current = root

        collection.forEach {
            val child = current.children[it] ?: return
            current = child
        }

        if (!current.isTerminating) return

        // 2
        current.isTerminating = false

        // 3
        val parent = current.parent
        while (current.children.isEmpty() && !current.isTerminating) {
            parent?.let {
                it.children.remove(current.key)
                current = it
            }
        }
    }

There is a minor left-right-typo in Chapter 8, page 192, in the implementation of the function leftRightRotate.
See also

The third line of the function should be
node.leftChild = leftRotate(leftChild)
instead of
node.leftChild = rightRotate(leftChild)

Hey there,

Thank you for pointing out this error — it has been corrected in the 2nd edition, which is now available :slight_smile: