Beispiel #1
0
  /**
   * Insert data into the node, for the right child only. Check if the rigth child is null or not.
   * If it is, then add a new node using the supplied insert value. If its not null, then
   *
   * @param insertValue data to insert
   */
  public void insertRight(char insertValue) {
    // check if the left node is null

    if (rightNode == null) // check the right child
    {
      rightNode = new BinaryNode(insertValue); // add a new node
    } // end if(leftNode == null)
    else {
      // insert this data as a node further down the tree
      rightNode.insertRight(insertValue);
    } // end else
  } // end public void insert(Object insertValue)