Implementato Binary Tree. Bisogbna testarlo. da implementare il tostring

This commit is contained in:
2014-04-26 22:02:12 +02:00
parent 3fe3c635d8
commit cd1a246d4f
6 changed files with 413 additions and 3 deletions

35
binarytree/BTNode.java Normal file
View File

@@ -0,0 +1,35 @@
package binarytree;
public class BTNode<E> implements BTPosition<E> {
private E element = null;
private BTPosition<E> left = null;
private BTPosition<E> right = null;
private BTPosition<E> parent = null;
public BTNode() { }
public BTNode(E element, BTPosition<E> parent, BTPosition<E> left, BTPosition<E> right) {
setElement(element);
setParent(parent);
setLeft(left);
setRight(right);
}
public E element() { return element; }
public void setElement(E o) { element=o; }
public BTPosition<E> getLeft() { return left; }
public void setLeft(BTPosition<E> v) { left=v; }
public BTPosition<E> getRight() { return right; }
public void setRight(BTPosition<E> v) { right=v; }
public BTPosition<E> getParent() { return parent; }
public void setParent(BTPosition<E> v) { parent=v; }
}