Errata: Data Structures and Algorithms Book!

Binary Tree Traversal code has two mistakes:

  1. In breadthFirstTraversal, the line observed.enqueue(root) should be discovered.enqueue(root)

  2. In depthFirstTraversal, if you are using the Stack implementation from the book as opposed to including the one from kirupa.com, you will be missing the length method.

Both of these issues are fixed in the version of the full example shared here: kirupa/data_structures_algorithms/binary_tree_traversal.htm at master · kirupa/kirupa · GitHub

Thanks again to @timfrobisher for pointing these two issues out.