예제 #1
0
 private void traverse(Node<T, V> subTree) {
   if (subTree == null) {
     return;
   } else {
     System.out.print(subTree.t + " ");
     traverse(subTree.leftChild);
     traverse(subTree.rightChild);
   }
 }
예제 #2
0
  @Override
  public String toString() {
    // TODO Auto-generated method stub
    // preroot to show the structure of this tree

    traverse(tree);

    return "-- Pre-root traverse of the current tree.";
  }