private int countLeaf(Node t){ if(t==null) return 0; else if(t.left==null&&t.right==null) return 1; else return countLeaf(t.left)+countLeaf(t.right); } public void countleaf(){ System.out.println(countLeaf(r)); }
Không có nhận xét nào: