package hw5;
public class LinkedIntSet {
private static class Node {
private int data;
private Node next;
public Node(int data, Node next) {
this.data = data;
this.next = next;
}
}
private Node first; // Always points to the first node of the list.
// THE LIST IS ALWAYS IN SORTED ORDER!
private int size; // Always equal to the number of elements in the set.
/**
* Construts an empty set.
*/
public LinkedIntSet() {
throw new RuntimeException("Not implemented");
}
/**
* Returns the number of elements in the set.
*
* @return the number of elements in the set.
*/
public int size() {
throw new RuntimeException("Not implemented");
}
/**
* Tests if the set contains a number
*
* @param i the number to check
* @return
true
if the number is in the set and
false
* otherwise.
*/
public boolean contains(int i) {
throw new RuntimeException("Not implemented");
}
/**
* Adds
element
to this set if it is not already present and
* returns
true
. If
element
is already present, the
* set is unchanged and
false
is returned.
*
* @param element the element to be added
* @return
true
if the element was added and
false
* otherwise.
*/
public boolean addElement(int element) {
throw new RuntimeException("Not implemented");
}
/**
* Removes an element from the set.
*
* @param element the element to be removed
* @return
ture
if the element was removed and
false
* otherwise.
*/
public boolean removeElement(int element) {
throw new RuntimeException("Not implemented");
}
/**
* Returns true if
this
and
other
have the same
* elements and false otherwise.
*
* @param other the set to compare against for equality
* @return true if
this
and
other
have the same
* elements and false otherwise.
*/
public boolean subset(LinkedIntSet other) {
throw new RuntimeException("Not implemented");
}
}