CSSE 230: Binary Search Tree Exercise - Part 2

This is the second part of a three part assignment.

Please work on this exercise by yourself.

For this portion, you will focus on ways of navigating a tree through tree iterators.

  1. Continue working on the BinarySearchTree.java file that you edited as part of BST - part 1
  2. Ensure that the iterators are inner classes and that your code takes advantage of the access rights that come with inner classes.
  3. Add the following iterators. Ensure the iterators are lazy and invoke them with the following methods:
    1. iterator()
    2. descendingIterator()
    3. preOrderIterator()
    4. levelOrderIterator()
  4. Use appropriate iterators to implement the following methods:
    1. toArray()
    2. toString()
  5. Use the following JUnit test suite to test your code. I adjusted some of the points to accomidate some new features. I will eventually add some more testcase for the removal portion that we will see in part 3.
  6. Submit your BinarySearchTree.java file to the appropriate dropbox on Moodle at 23:59 on day 7.