Two Bugs in LinkedList data structure in Absolute Beginner's Guide to Algorithms

Hi,

A couple more issues.

The main one is a bad variable in the breadthFirstTraversal function:

observed.enqueue(root);

But observed doesn’t exist. It should be

discovered.enqueue(root);

The other issue is with the call to Stack.length in the depthFirstTraversal function:

while (discovered.length > 0) {

This works fine using the code provided online. However, there is no get length() function in the Stack implementation from the book. So, this will fail if using the book implementation of the Stack.