Find the Minimum and Maximum Value in a Binary Search Tree

In this challenge you will define two methods, findMin and findMax. These methods should return the minimum and maximum value held in the binary search tree (don't worry about adding values to the tree for now, we have added some in the background). If you get stuck, reflect on the invariant that must be true for binary search trees: each left subtree is less than or equal to its parent and each right subtree is greater than or equal to its parent. Let's also say that our tree can only store integer values. If the tree is empty, either method should return null.

Tests

  • Waiting: 1. The BinarySearchTree data structure should exist.
  • Waiting: 2. The binary search tree should have a method called findMin.
  • Waiting: 3. The binary search tree should have a method called findMax.
  • Waiting: 4. The findMin method should return the minimum value in the binary search tree.
  • Waiting: 5. The findMax method should return the maximum value in the binary search tree.
  • Waiting: 6. The findMin and findMax methods should return null for an empty tree.
/**
* Your test output will go here
*/