Depth-first search
==================

Suppose `neighbors(cell)` returns filled neighbors in order: above, to
the right, below, and to the left.

        X
     #--#-
     ###### Y
     #----#
     Z

If we start in the upper-left, what order will the labeled cells be
visited?

a.  *X, Y, Z*
b.  Y, X, Z
c.  X, Z, Y
d.  Z, X, Y

Find the tail
=============

``` {.java}
LLNode<T> t = head
// code from below goes here
```

Assuming at least one element in the list, which line of code leaves `t`
pointing at the tail of the list?

a.  `while (t != null) t = t.getNext();`
b.  `while (t != null) t.setNext(t.getNext());`
c.  `while (t.getNext() != null) t.getNext();`
d.  *`while (t.getNext() != null) t = t.getNext();`*

What happens if...
==================

``` {.java}
public void reverse() {
  if (head == null) return;
  if (head.getNext() == null) return;
  LLNode<T> temp = head;
  temp.setNext(null);     // moved up
  head = head.getNext();  // moved down
  reverse();
  addToTail(temp.getContents);
```

If we switch line 5 and line 6:

a.  code still works as intended
b.  code won't compile
c.  *lists longer than one element are truncated*
d.  the list won't be changed

Fibonacci without recursion
===========================

``` {.java}
private int fib(int n) {
  if (n <= 1) return n;
  return fib(n-1) + fib(n-2);
}
```

Can we eliminate this recursion using a single stack and a single call to
`push()` and `pop()` per iteration?

a.  yes
b.  no, because the method is `private`
c.  no, because `int`s cannot be stored on a stack
d.  *no, because the method makes two recursive calls*

(We can't simply use a single stack and the trivial push-them-all 
pop-them-all approach, but note we *can* generally use stacks to replace 
recursion. More later and in CMPSCI 250.)