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(54, topNode)
          

Choices are:

  • A
  • B
  • C
  • D
  • B
    • A
    • C
    • D

    There are no hints for this question.