CSSE 230
Data Structures and Algorithm Analysis

Written Assignment 6  -  67 points

Don't forget that you should be making notes about your team and team members, for eventual use in the EditorTrees team evaluation.

To Be Turned In

Question 1 should be submitted to the drop box on ANGEL and questions 2 and 3 should be committed to your repository in SVN.  You may earn a late day by submitting all parts early, or use  a late day if submit any part late.

    1. (10 points) Exercise 19.2 included finding the probability (based on equally likely insertion orders of each of the 24 permutations) of each of the 14 different trees that can result when inserting the numbers 1, 2, 3, and 4 into an initially empty BST (with no re-balancing).

      1. With the same assumption (that all permutations of the four numbers are equally likely), what is the (weighted) average height of the BSTs?
      2. With the same assumptions, do the same exercise for inserting the four numbers into an AVL tree. In other words, what is the average height of the AVL trees?
    2. (25 points) Complete the Object-oriented solution to the non-attacking queens problem from the Session 16 class.  Submit to your SVN repository.
      A student asked:
      Are we permitted to add methods and/or fields to the Queen & NullQueen class for problem 2 of the Written Assignment? Or can we only alter the RealQueen class?
      My answer:
      You should not change Queen.java or NullQueen.java at all, and you should not add any fields to RealQueen.java. Of course you can declare local variables inside the methods, and additional helper methods if needed (my code does not add any methods, but yours can).
    3. (32 points) For this task you’ll add four more methods to the Threaded Binary Search Tree project. Check out the new template code given in ThreadedTree2 in your individual SVN repository.

      The methods you are to write are the last two methods in ThreadedBinaryNode and the last two in ThreadedBinarySearchTree. Near the end of ThreadedBinarySearchTree, you’ll find a couple of new methods that illustrate the use of the methods you will write. The code in the JUnit tests in ThreadedTree2Test.java should also help you to understand how your methods should work.

      Your code, which you should commit to your repository, should pass all of the unit tests in ThreadedTree2Test.java, plus the other unit tests that are already passed by the template code. That is, don’t break the existing code while adding your code. You can right-click a project to run all the JUnit tests in the entire project. That’s how we’ll test your solution.

    Other problems for your consideration

    6.5[6.5], 6.31[6.17], 6.37[6.22], 7.3[7.3], 7.4[7.4], 7.23[7.19], 7.28[7.23]