Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Find the maximum key of the BST */
- public Key findMax() {
- return findMax(root).key; // 1
- }
- /* Private findMax() method */
- private Node<Key, Value> findMax(Node<Key, Value> x) {
- if (x.right == null) { // 2
- return x; // 2
- }
- return findMin(x.right); // 3
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement