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()); } |