From 479cac03939e8ae6dd3b6ae075252d55aeb3f4ec Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Mon, 31 Oct 2022 20:50:09 +0100 Subject: [PATCH] Fix broken `balance` method --- app/src/main/java/ch/nuth/zhaw/exbox/AVLSearchTree.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/ch/nuth/zhaw/exbox/AVLSearchTree.java b/app/src/main/java/ch/nuth/zhaw/exbox/AVLSearchTree.java index 768e99f..c7cefd9 100644 --- a/app/src/main/java/ch/nuth/zhaw/exbox/AVLSearchTree.java +++ b/app/src/main/java/ch/nuth/zhaw/exbox/AVLSearchTree.java @@ -43,18 +43,18 @@ public class AVLSearchTree> extends SortedBinaryTree } else if (height(p.left) - height(p.right) == 2) { if (height(p.left.left) >= height(p.left.right)) { // TODO Implement (6.2) - rotateR(p); + p = rotateR(p); } else { // TODO Implement (6.2) - rotateLR(p); + 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) - rotateL(p); + p = rotateL(p); } else { // TODO Implement (6.2) - rotateRL(p); + p = rotateRL(p); } } p.height = Math.max(height(p.left), height(p.right)) + 1;