Änderungen am Binary Tree
This commit is contained in:
parent
2ee19fc746
commit
1996730d1c
|
@ -11,4 +11,10 @@ public class Tree<T> {
|
||||||
public Node<T> getRoot() {
|
public Node<T> getRoot() {
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if(obj instanceof Tree) return root.equals(obj);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -28,5 +28,6 @@ public class VorlesungsTest {
|
||||||
assertEquals(Integer.valueOf(45), tree.getRoot().getValue());
|
assertEquals(Integer.valueOf(45), tree.getRoot().getValue());
|
||||||
assertEquals(Integer.valueOf(14), tree.getRoot().getLeft().getValue());
|
assertEquals(Integer.valueOf(14), tree.getRoot().getLeft().getValue());
|
||||||
assertEquals(Integer.valueOf(16), tree.getRoot().getRight().getValue());
|
assertEquals(Integer.valueOf(16), tree.getRoot().getRight().getValue());
|
||||||
|
assertEquals(new Node<Integer>(13, new Node<>(14), new Node<>(16)), new Node<Integer>(13, new Node<>(14), new Node<>(16)));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue