public class AATree<T extends java.lang.Comparable<? super T>>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
AATree.BinaryNode |
Modifier and Type | Field and Description |
---|---|
AATree.BinaryNode |
root |
int |
rotationCount |
Constructor and Description |
---|
AATree()
Constructor for an empty tree.
|
Modifier and Type | Method and Description |
---|---|
void |
find(T e) |
int |
getRotationCount() |
int |
height() |
boolean |
insert(T element)
This is the only method that enables the user to add elements to the
AA tree.
|
boolean |
remove(T element)
This method enables a user to remove an element from the
AA tree.
|
void |
resetRotationCount() |
int |
size()
The method returns the number of nodes in the tree.
|
java.lang.Object[] |
toArray()
This method returns an array containing all nodes in the tree.
|
java.util.ArrayList<java.lang.Object> |
toArrayList()
This method returns an ArrayList containing all nodes in the tree.
|
java.lang.String |
toString()
This method produces a string representation of all elements in the
tree.
|
public AATree.BinaryNode root
public int rotationCount
public AATree()
public int getRotationCount()
public void resetRotationCount()
public void find(T e)
public boolean insert(T element)
element
- The only parameter is the element to be added to the tree.
It has to be of the parameterized type Comparable that was used to create
the tree.public boolean remove(T element)
element
- The only parameter is the element to be added to the tree.
It has to be of the parameterized type Comparable that was used to create
the tree.public java.lang.String toString()
toString
in class java.lang.Object
public int height()
public int size()
public java.lang.Object[] toArray()
public java.util.ArrayList<java.lang.Object> toArrayList()