Assignment 5 Solution Java

Concepts
tested by this program:

Generic Classes

            Comparators

 

New
concepts tested by this program

            Linked Trees

            Binary Search Trees

 

Your
assignment is to write a generic linked list tree and a generic linked list  binary search tree class that inherits from
your generic linked tree class.  There is
no GUI required for this assignment. 
Your classes will be tested with Junit tests.

 

TreeNodeclass

            This
generic class is used in the BasicLinkedTree and BSTree classes.  The class consists of a reference to the data
and a reference to the left and right child.Follow the Javadoc that is
provided.  The Javadoc only lists those
public methods that are required to pass the Junit tests.  You may add any private methods you need for
your design.

 

BasicLinkedTreeclass

            This generic linked list tree relies on a root (reference
to root of the tree).  The root is set to
null when the list is empty. The class uses an external generic TreeNode class
which consists of a reference to the data and a reference to the left and right
child. The private members consist of a root (reference to a TreeNode) and the
size (number of Nodes in the tree) 
Follow the Javadoc that is provided. 
The Javadoc only lists those public methods that are required to pass
the Junit tests.  You may add any private
methods you need for your design.

 

 

BSTreeclass

            A generic linked binary search tree which inherits from
the BasicLinkedTree class anduses a provided Comparator.  The class uses an external generic TreeNode
class.  There is only one additional
private member, a comparator to determine the order of the nodes.  This class uses the private members of root
and size which are defined in the BasicLinked List.  Follow the Javadoc that is provided.The
Javadoc only lists those public methods that are required to pass the Junit
tests.  You may add any private methods
you need for your design.
Powered by