Revise the algorithm of Figure 6.6 so that it performs an in-order enumeration, rather than preorder. Figure

Question:

Revise the algorithm of Figure 6.6 so that it performs an in-order enumeration, rather than preorder.

Figure 6.6:

class BinTree implements Iterable { BinTree left; BinTree right; T val; // other methods: insert, delete, lookup, ... public Iterator iterator () { return new TreeIterator (this); private class TreeIterator implements Iterator { private Stack s = new Stack(); TreeIterator (BinTree n) { if (n.val != null) s.push(n); public boolean

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: