Levelorder

Hide text Hide pseudo-code

Traverse the following binary tree in level order.

void traverse_levelorder(link t)
{
  queue.put(t);
  do {
    t = queue.get();
    if (t != null) {
      visit(t);
      queue.put(t.getLeft());
      queue.put(t.getRight());
    }
  } while (!queue.empty());
}


  Created Wed Jun 20 16:00:44 EEST 2007 - Powered by SVG-hut