I. An Example of Tree Coding A. Using source code from the textbook 1. Finding the code a. the code from the textbook can be found at the following URL: b. http://www.cs.fiu.edu/~weiss/dsj/code/ 2. The Supporting package a. it will be convenient to use Weiss' package of "Supporting" code, which implements a wrapper class for integers (among other things); see the site for the source 3. Setting up your directories a. in order to use the Supporting package, you will need to have the files in a directory called Supporting in a path accessible to your project b. (similar remarks hold for the "DataStructures" package, which contains the stack classes) 4. Import statements a. at the top of your java files you will need the following import statement: import Supporting.*; 5. Other source code files a. for your programming project you will also need Weiss' implementation of stacks, available at the above URL; you may use any additional code he provides that seems useful for the project B. The BinaryNode and BinaryTree classes 1. Code for the BinaryNode class a. the code is discussed in the text on page 464 and is stored locally on Gemini in the directory: ~fruehr/public_html/dsa/code/TreeTest/BinaryNode.java 2. Code for the BinaryTree class a. the code is discussed in the text on page 466 and is stored locally on Gemini in the directory: ~fruehr/public_html/dsa/code/TreeTest/BinaryTree.java 3. BinaryNode versus BinaryTree a. the main differences between the two classes are that BinaryNodes support a constructor which takes all three natural arguments and that the BinaryTree methods check for the current tree being null C. The TestTree project 1. Code for the TestTree class a. the code is stored locally on Gemini in the directory: ~fruehr/public_html/dsa/code/TreeTest/TreeTest.java 2. Int, MyInteger and String a. note how the declaration of elements as objects affects the construction of the different types of nodes (operators versus operands) in the tree 3. Code from the Supporting package a. for this example, I needed only the Comparable and Hashable interfaces and the MyInteger class itself D. Simulating generics in Java 1. Generic programs a. programs are said to be generic if they are written in a general way, but can be used for any particular type of data necessary in a given application 2. Generic data structures a. many data structures, such as lists, stacks and trees, can be construed as generic with respect to the components they contain: most algorithms do not actually manipulate the components themselves, and so should work for an arbitrary component type 3. Language support for generics a. most modern programming languages support generic programming directly through features in their type systems; Java is an unfortunate exception 4. Simulating generics a. in Java, we can simulate the effect of generics by using the class Object and type-casting to convert to a more restricted class when necessary