private void balanceAfterInsert(AVLNode<T> node) {
		int balanceFactor = node.getBalanceFactor();
		if (balanceFactor > 1 || balanceFactor < -1) {
			AVLNode<T> parent = null;
			AVLNode<T> child = null;
			Balance balance = null;
			if (balanceFactor < 0) {
				parent = (AVLNode<T>) node.lesser;
				balanceFactor = parent.getBalanceFactor();
				if (balanceFactor < 0) {
					child = (AVLNode<T>) parent.lesser;
					balance = Balance.LEFT_LEFT;
				} else {
					child = (AVLNode<T>) parent.greater;
					balance = Balance.LEFT_RIGHT;
				}
			} else {
				parent = (AVLNode<T>) node.greater;
				balanceFactor = parent.getBalanceFactor();
				if (balanceFactor < 0) {
					child = (AVLNode<T>) parent.lesser;
					balance = Balance.RIGHT_LEFT;
				} else {
					child = (AVLNode<T>) parent.greater;
					balance = Balance.RIGHT_RIGHT;
				}
			}

			if (balance == Balance.LEFT_RIGHT) {
				// Left-Right (Left rotation, right rotation)
				rotateLeft(parent);
				rotateRight(node);
			} else if (balance == Balance.RIGHT_LEFT) {
				// Right-Left (Right rotation, left rotation)
				rotateRight(parent);
				rotateLeft(node);
			} else if (balance == Balance.LEFT_LEFT) {
				// Left-Left (Right rotation)
				rotateRight(node);
			} else {
				// Right-Right (Left rotation)
				rotateLeft(node);
			}

			node.updateHeight(); // New child node
			child.updateHeight(); // New child node
			parent.updateHeight(); // New Parent node
		}
	}