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