Print a binary tree level by level
Sigiloso
public Void BFS() { Queue q = new Queue(); q.Enqueue(root);//You don't need to write the root here, it will be written in the loop while (q.count > 0) { Node n = q.DeQueue(); Console.Writeln(n.Value); //Only write the value when you dequeue it if (n.left !=null) { q.EnQueue(n.left);//enqueue the left child } if (n.right !=null) { q.EnQueue(n.right);//enque the right child } } }