public void PreOrderTraversal() { // printing root note Console.Write(data + " "); // Going to left child if (leftNode != null) { leftNode.PreOrderTraversal(); } // Going to right children if (rightNode != null) { rightNode.PreOrderTraversal(); } }
public void PreOrderTraversal() { root?.PreOrderTraversal(); }