From 42ad8dd1c2d4e76a5775b7a03e2a65aaf1eab759 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 11 Feb 2018 09:45:51 +0100 Subject: [PATCH] Make the "else if" more logic regarding the conditions. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- Arbres/ArbreBinaire.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Arbres/ArbreBinaire.java b/Arbres/ArbreBinaire.java index ee0f27b..fc19203 100644 --- a/Arbres/ArbreBinaire.java +++ b/Arbres/ArbreBinaire.java @@ -69,7 +69,8 @@ public class ArbreBinaire { private IntNode inserer_rec(IntNode currentNode, int value) { if (currentNode == null) { return new IntNode(value); - } else if (value < currentNode.getData()) { + } + if (value < currentNode.getData()) { currentNode.setLeftNode(inserer_rec(currentNode.getLeftNode(), value)); } else if (value > currentNode.getData()) { currentNode.setRightNode(inserer_rec(currentNode.getRightNode(), value)); @@ -84,7 +85,8 @@ public class ArbreBinaire { private IntNode supprimer_rec(IntNode currentNode, int value) { if (currentNode == null) { return null; - } else if (value == currentNode.getData()) { + } + if (value == currentNode.getData()) { if (currentNode.getLeftNode() == null && currentNode.getRightNode() == null) { return null; } else if (currentNode.getRightNode() == null) { -- 2.34.1