Scientific Programming II

Programming in Java

Unit 6 - Assignment


You may want to also define some smaller helper methods to simplify writing these methods.


Problem 1 (5+5 Points)

Add the following methods in Tree.java and test the same in TreeTest.java:

  1. A method which returns the maximum value in the BST.
  2. A method which returns the minimum value in the BST.

Problem 2 (5+5 Points)

Add the following methods in Tree.java and test the same in TreeTest.java:

  1. A method which prints all the leaves in the BST. A leaf in a BST is a node whose left and right references are both equal to “null”.
  2. A method which takes an input search value as an argument and prints a line stating if the BST contains the search value or not.