Given:

            private BinaryNode insert(T data, BinaryNode node) {
              if (node == null) {
                  return new BinaryNode(data);
              }
              else if (data.compareTo(node.getData()) < 0) {
                  node.setLeft(insert(data, node.getLeft()));
              }
              else if (data.compareTo(node.getData()) > 0) {
                  node.setRight(insert(data, node.getRight()));
              }
              else {//entry exists
                 if (node.getRight() != null) {
                    BinaryNode minNode = findMin(node.getRight());
		                if (data.compareTo(minNode.getData())== 0) {//update
		                    minNode.setRight(new BinaryNode(data));
		                } else {
		                    minNode.setLeft(new BinaryNode(data)); 
		                }      
                  } else {
                      node.setRight(new BinaryNode(data));
                  }            
              }
              return node;
          }
          

and

in order 18, 20, 25, 29, 31, 34, 49, 50, 60, 74, 83, 84, 85, 87, 89, 92, 99

What would the following method call result in:

            insert(55, topNode)
          

Choices are:

  • A
    added 55 as left child of 60
  • B
    added 55 as right child of 50
  • C
    made 55 root and 54 right child of 50
  • D
    made 55 root and added 54 as left child of 60
  • A
    • B
    • C
    • D

    There are no hints for this question