1: // Removes the node containing the largest entry in a given tree.
2: // rootNode is the root node of the tree.
3: // Returns the root node of the revised tree.
4: // @author Frank M. Carrano, Timothy M. Henry
5: // @version 5.0
6: private BinaryNode<T> removeLargest(BinaryNode<T> rootNode)
7: {
8: if (rootNode.hasRightChild())
9: {
10: BinaryNode<T> rightChild = rootNode.getRightChild();
11: rightChild = removeLargest(rightChild);
12: rootNode.setRightChild(rightChild);
13: }
14: else
15: rootNode = rootNode.getLeftChild();
17: return rootNode;
18: } // end removeLargest