Programming Assignment 1
CS 31600
Programming Languages
Spring, 2023

This assignment makes use of the files contained in this zip file. This assignment is due Tuesday, February 7.

This assignment is made up of several small parts. In the zip file there are Java files

Each of these files asks you to write a method that processes binary tree data structures from the binarytree package. Carefully read the description of each method and then implement the method. Each of those files contains a main() method that provides a simple test of the method you need to write. These tests are not very complex, and they may not be enough to verify that your implementation is correct. You should think about and write your own tests and add them to the main() method. When I grade your assignments, I will test your methods with more complex cases than the ones in these simple tests.

All the test cases generate pictures of their binary trees so that you can better see if your results are correct. The pictures of the trees are created by the Graphviz program. You should install Graphviz on your computer. You can use one of Graphviz's installer programs, or you can download and unzip the "portable" version of Graphviz. Depending on where you install Graphviz, you may need to change lines 41 and 48 of the file binarytree\BTree2png.java. That program assumes you have Graphviz installed in the folder C:\Graphviz.

Some of the methods return a binary tree as their result. Those methods need to instantiate binary tree data structures. The binarytree package has four different implementations of the binary tree data structure. So which one should you use in your code? Each of those methods specifies as its return value type which kind of binary tree data structure to use.

In the zip file there is a file called SearchForEvenOdd_soln.java. This is a completed Java program and it is there to give you a hint about how to implement SearchForInteger.java. You should be able to compile and run the program SearchForEvenOdd_soln.java. This program gives you a good test case for your development environment and also for the Graphviz program.

Your code should compile without any warnings. These are programs that use Java generics. Getting generic code to compile without warnings can be tricky. But the warnings always mean that you are doing something wrong (they are really errors, not warnings). So try to figure out what is causing each warning (it is usually because you are either forgetting a type parameter or using the wrong type parameter). Ask me questions if you get stuck.

Here is an introductory chapter on generics. Look specifically at Sections 10.1 and 10.5.

Do not change the package structure of this code. The binary tree implementations are in the binarytree package. The seven programs listed above are in the "default" (unnamed) package. Don't change that. Do not put those seven files into some named package.

Turn in a zip file called CS316Hw1Surname.zip (where Surname is your last name) containing your versions of the seven Java files listed above. Please be sure to put your name in each of your files.

This assignment is due Tuesday, February 7.