左孩子结点和右孩子结点都为空的结点就是叶子结点
int numberOfLeavesInBTusingLevelOrder(BinaryTreeNode root){
BinaryTreeNode temp;
LLQueue q = new LLQueue();
int count = 0;
if(root == null){
return 0;
}
q.enQueue(root);
while(!q.isEmpty()){
temp = q.deQueue();
if(temp.getLeft() == null && temp.getRight() == null)
count++;
else{
if(temp.getLeft() != null){
q.enQueue(temp.getLeft());
}
if(temp.getRight()){
q.enQueue(temp.getRight());
}
}
}
q.deleteQueue();
return count;
}