Binary Tree, Data Structure Algorithm, Algorithms, Dotnet, Csharp.
Enqueue the left child if it exists if (currentNode.left != null) { queue.Enqueue(currentNode.left); } // Enqueue the right child if it exists if (currentNode.right != null) { queue.Enqueue(currentNode.right); } } // Add the current level's node values to the result list result.Add(currentLevel); }