Starting from:

$29

 Elementary Data Structures and Algorithms   Assignment 5

Elementary Data Structures and Algorithms
  Assignment 5

Assignment 5 Skills
Linked Data
Assignment 5 Background
For this assignment we will be building off of Assignment 4.
Assignment 5 Requirements
1. (10%) Update your SetInterface if needed. This interface should have the following methods defined:
(a) Add, that adds an element to the set if able.
(b) Remove (random), that removes a (random) element from the set. This does not have to be
truly random.
(c) Remove (specified), that removes a specified element from the set if able.
(d) isEmpty, that determines the emptyness of the set.
(e) getCurrentSize, that returns the number of elements currently in the set.
(f) clear, that removes all elements from the set.
(g) contains, that determines whether a specified element is in the set.
(h) union, that returns a set with all of the elements of this set, and the specified set.
(i) intersection, that returns a set with all of the common elements in this set, and the specified
set.
(j) difference, that returns a set with all of the elements in this set, that are not in the specified
set.
2. (10%) Provide comments for the interface as necessary being sure to document:
(a) the expected behavior of each method.
(b) the return types, and expected return values (if any).
(c) the conditions for success/failure, and expected handling of such (if any).
(d) anything else of importance in your design choices.
3. (20%) Write a class called Node. This class should include the following:
(a) an private Object reference for the stored data.
(b) a private Node reference for the next link.
(c) Constructors/getters/setters as necessary.
4. (30%) Write a class called LinkedSet that implements the SetInterface interface. This class should
include the following:
(a) a private head Node to hold the chain of set elements.
(b) implementations for all of the interface methods.
(c) a toString method for displaying the contents of the set.
5. (10%) Provide comments for the class as necessary being sure to document:
(a) how you add elements to the chain.
(b) how you remove elements from the chain.
(c) anything else of importance in your implementation choices.
6. (20%) Write a main method in a file called SetTest.java. Your main method should test your
implementation thoroughly. Be sure to document what you are testing at each point.
Assignment 5 Submission Submit on Blackboard:
1. SetInterface.java
2. Node.java
3. LinkedSet.java
4. SetTest.java
Required Each submitted file should include your name and a statement that this is your own work. This
should appear as a comment at the beginning of any code file.

More products