using System.Collections.Generic;
public static void Main()
Console.WriteLine("\n-------\n");
PrintLevelsLineByLine(root);
public static Node BuildTree(){
Node three = new Node(3);
Node seven = new Node(7);
Node eight = new Node(8);
public static void PrintLevelsLineByLine(Node n){
Queue<Node> q = new Queue<Node>();
if(nodeCount == 0) break;
Console.WriteLine(";{0}#ROOT#{1}", depth, q.Peek().data);
Console.WriteLine(";{0}#L#{1}", depth, cur.left.data);
Console.WriteLine(";{0}#R#{1}", depth, cur.right.data);
public static void PrintLevelOrder(Node root)
Queue<Node> queue = new Queue<Node>();
Node tempNode = queue.Dequeue();
Console.WriteLine(";{0}#ROOT#{1}", depth, tempNode.data);
if (tempNode.left != null) {
Console.WriteLine(";{0}#L#{1}", depth, tempNode.left.data);
queue.Enqueue(tempNode.left);
if (tempNode.right != null) {
Console.WriteLine(";{0}#R#{1}", depth, tempNode.right.data);
queue.Enqueue(tempNode.right);