public void TraverseTree() { if (parentNode != null) { parentNode.TraverseTree(); } }
public void TraverseTree() { //fist we go to the left and this function will travel allll the way to the leftmost (smallest) node and begin to print out data and call recursively to hit each node in the tree if (left != null) { left.TraverseTree(); } //print root node Console.Write(data + " "); //then go right node which will print itself as both its children will be null if (right != null) { right.TraverseTree(); } }