public class IntBalancedSet
extends java.lang.Object
implements java.lang.Cloneable
IntBalancedSet is a set of int numbers, stored in a B-tree.
Outline of Java Source Code for this class:
http://www.cs.colorado.edu/~main/edu/colorado/collections/IntTreeBag.java
Note:
This file contains mostly blank implementations ("stubs")
because this is a Programming Project for my students.IntArrayBag,
IntLinkedBag,
IntTreeBag| Constructor and Description |
|---|
IntBalancedSet()
Initialize an empty set.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int element)
Add a new element to this set.
|
java.lang.Object |
clone()
Generate a copy of this set.
|
boolean |
contains(int target)
Accessor method to determine whether a particular element is in this set.
|
void |
print(int indent) |
boolean |
remove(int target)
Remove a specified element from this set.
|
void |
transferLeft(int i) |
void |
transferRight(int i) |
public IntBalancedSet()
java.lang.OutOfMemoryError - Indicates insufficient memory for adding a new element.public void add(int element)
element - the new element that is being added
Postcondition:
If the element was already in this set, then there is no change.
Otherwise, the element has been added to this set.java.lang.OutOfMemoryError - Indicates insufficient memory for adding a new element.public java.lang.Object clone()
clone in class java.lang.ObjectIntBalancedSet before it
can be used.java.lang.OutOfMemoryError - Indicates insufficient memory for creating the clone.public boolean contains(int target)
target - an element that may or may not be in this settrue if this set contains target;
otherwise falsepublic boolean remove(int target)
target - the element to remove from this settarget was found in this set, then it has been removed
and the method returns true. Otherwise this set remains
unchanged and the method returns false.public void print(int indent)
public void transferLeft(int i)
public void transferRight(int i)