The below code is for printing level-by-level in a binary tree://level order printingpublic static void levelOrderPrint(Node root){    Queue<Node> que = new LinkedList<Node>();    Node mark = new Node(0);    if(root != null){        que.add(root);        que.add(mark);    }    while(!que.isEmpty()){        Node temp = que.poll();        if(temp != mark)        System.out.print(temp.key);        if(temp == mark){            if(que.peek() == mark || que.isEmpty()){                return;            }            que.add(mark);            System.out.println();        }        if(temp.left != null){            que.add(temp.left);        }        if(temp.right != null){            que.add(temp.right);        }    }}I would like to know if there are any bugs or possible optimizations.
Printing the values on each level of a Binary Tree
java;algorithm;tree