用于树结构遍历方法 static void tree(Node b, int depth) { for(int i=0; i<depth; i++) System.out.print("--"); b.p(); if(b instanceof BranchNode) { for (Node n : ((BranchNode)b).nodes) { tree(n, depth + 1); } } }