Processing math: 100%

Terminology

Learn all these terms:

The Wonder and Joy of Binary Trees

  1. log2h
  2. 2h+1
  3. 2h1
  4. 2h+h
  5. h!

The Wonder and Joy of Binary Trees

Exercise #2

  1. log2n+1
  2. log2n+1
  3. n2
  4. n
  5. 2n

Exercise #2

Take Home Message

Traversals

Traversals

Trace the following traversal method...

  public static <E> void mystery(BinNode<E> rt) {
    Queue<BinNode<E>> queue = new LQueue<>();

    queue.enqueue(rt);

    while (queue.length() > 0) {
      BinNode<E> cur = queue.dequeue();

      visit(cur);

      if (cur.left() != null) {
        queue.enqueue(cur.left());
      }
      if (cur.right() != null) {
        queue.enqueue(cur.right());
      }
    }

  }