hello,
can u pls help me sir about my problem in the level order travelsal?... i did trace my code and i found no wrong. but when i compile it, there's something wrong in it and i dont know where...
thank u very much!
int count = 1;
public void levelorderTraversal(BinaryTree input) throws Exception{
System.out.print(input.root + " ");
BinaryTree yes = new BinaryTree();
BinaryTree temp;
Queue queue = new Queue();
queue.enqueue(input.leftSubTree);
queue.enqueue(input.rightSubTree);
if(queue.isEmpty()){
return;
}else{
if(count == 1){
temp = (BinaryTree) queue.dequeue();
count = 2;
yes.levelorderTraversal(temp);
}else if(count == 2){
temp = (BinaryTree) queue.dequeue();
count = 1;
yes.levelorderTraversal(temp);
}
}
}