Constructor and Description |
---|
AVLTreeNode(E el)
Create an AVLTreeNode as a root leaf
|
AVLTreeNode(E el,
AVLTree.AVLTreeNode parent)
Create an AVLTreeNode node containing one element to be considered
child of the given parent.
|
Modifier and Type | Method and Description |
---|---|
int |
getBalanceFactor()
Determina il fattore di bilanciamento di questo nodo.
|
int |
getCount() |
E |
getEl() |
int |
getHeight()
Restituisce l'altezza del sottoalbero la cui radice è questo nodo.
|
AVLTree.AVLTreeNode |
getLeft() |
AVLTree.AVLTreeNode |
getMaximum()
Restituisce il nodo contenente l'elemento massimo del sottoalbero di
cui questo nodo è radice.
|
AVLTree.AVLTreeNode |
getMinimum()
Restituisce il nodo contenente l'elemento minimo del sottoalbero di
cui questo nodo è radice.
|
AVLTree.AVLTreeNode |
getParent() |
AVLTree.AVLTreeNode |
getPredecessor()
Restituisce il nodo predecessore di questo nodo.
|
AVLTree.AVLTreeNode |
getRight() |
AVLTree.AVLTreeNode |
getSuccessor()
Restituisce il nodo successore di questo nodo.
|
int |
insert(E el)
Inserisce un elemento nell'albero AVL a partire da questo nodo.
|
boolean |
isBalanced()
Determina se questo nodo e tutti i suoi discendenti hanno un fattore
di bilanciamento compreso tra -1 e 1.
|
boolean |
isLeaf()
Determina se questo è un nodo foglia.
|
AVLTree.AVLTreeNode |
search(E el)
Ricerca un elemento a partire da questo nodo.
|
void |
setCount(int count) |
void |
setEl(E el) |
void |
setHeight(int height) |
void |
setLeft(AVLTree.AVLTreeNode left) |
void |
setParent(AVLTree.AVLTreeNode parent) |
void |
setRight(AVLTree.AVLTreeNode right) |
java.lang.String |
toString() |
void |
updateHeight()
Aggiorna l'altezza del sottoalbero la cui radice è questo nodo
supponendo che l'altezza dei nodi figli sia già stata aggiornata.
|
public AVLTreeNode(E el)
el
- the elementpublic AVLTreeNode(E el, AVLTree.AVLTreeNode parent)
el
- the elementparent
- the parent of the nodepublic AVLTree.AVLTreeNode getPredecessor()
public AVLTree.AVLTreeNode getSuccessor()
public AVLTree.AVLTreeNode getMaximum()
public AVLTree.AVLTreeNode getMinimum()
public boolean isLeaf()
public int getHeight()
public void updateHeight()
public int getBalanceFactor()
public boolean isBalanced()
public E getEl()
public void setEl(E el)
el
- the el to setpublic int getCount()
public void setCount(int count)
count
- the count to setpublic AVLTree.AVLTreeNode getLeft()
public void setLeft(AVLTree.AVLTreeNode left)
left
- the left to setpublic AVLTree.AVLTreeNode getRight()
public void setRight(AVLTree.AVLTreeNode right)
right
- the right to setpublic AVLTree.AVLTreeNode getParent()
public void setParent(AVLTree.AVLTreeNode parent)
parent
- the parent to setpublic void setHeight(int height)
height
- the height to setpublic java.lang.String toString()
toString
in class java.lang.Object
public AVLTree.AVLTreeNode search(E el)
el
- the element to search forpublic int insert(E el)
el
- l'elemento da inserireE
effettuati durante l'inserimento.