带有三个指针(左指针,右指针和兄弟指针)的二叉树,设计填充下一个兄弟指针
void FillNextSiblings(BinaryTreeNode root){
llQueue q = new LLQueue();
BinaryNode temp;
if(root == null)
return;
q.enQueue(root);
q.enQueue(null);
while(q.isNotEmpty()){
temp = q.deQueue();
if(temp == null){
q.enQueue(null);
}else{
temp.setNextSiblings(q.pop());
if(temp.getLeft() != null){
q.enQueue(temp.getLeft());
}
if(temp.getRight() != null){
q.enQueue(temp.getRight());
}
}
}
}