Remove TODO comments

This commit is contained in:
Manuel Thalmann 2022-10-31 21:47:42 +01:00
parent ac7372738c
commit ebdde65832

View file

@ -9,7 +9,6 @@ package ch.nuth.zhaw.exbox;
*/
public class AVLSearchTree<T extends Comparable<T>> extends SortedBinaryTree<T> {
private boolean balanced(TreeNode<T> node) {
// TODO Implement (6.4)
if (node == null) {
return true;
} else if (balanced(node.left) && balanced(node.right)) {
@ -25,7 +24,6 @@ public class AVLSearchTree<T extends Comparable<T>> extends SortedBinaryTree<T>
@Override
protected int calcSize(TreeNode<T> p) {
// TODO Implement (6.2)
return super.calcSize(p) + p.values.size() - 1;
}
@ -50,18 +48,14 @@ public class AVLSearchTree<T extends Comparable<T>> extends SortedBinaryTree<T>
return null;
} else if (height(p.left) - height(p.right) == 2) {
if (height(p.left.left) >= height(p.left.right)) {
// TODO Implement (6.2)
p = rotateR(p);
} else {
// TODO Implement (6.2)
p = rotateLR(p);
}
} else if (height(p.right) - height(p.left) == 2) {
if (height(p.right.right) >= height(p.right.left)) {
// TODO Implement (6.2)
p = rotateL(p);
} else {
// TODO Implement (6.2)
p = rotateRL(p);
}
}
@ -140,7 +134,6 @@ public class AVLSearchTree<T extends Comparable<T>> extends SortedBinaryTree<T>
node.right = removeAt(node.right, x);
}
// TODO Implement (6.5)
return balance(node);
}
}