📅  最后修改于: 2022-03-11 14:52:27.113000             🧑  作者: Mango
private static void iterateall(BinaryTree foo) {
Stack nodes = new Stack();
nodes.push(foo);
while (!nodes.isEmpty()) {
BinaryTree node = nodes.pop();
if (node == null)
continue;
System.out.println(node.node);
nodes.push(node.right);
nodes.push(node.left);
}
}