From: Jérôme Benoit Date: Sun, 11 Feb 2018 08:45:51 +0000 (+0100) Subject: Make the "else if" more logic regarding the conditions. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=42ad8dd1c2d4e76a5775b7a03e2a65aaf1eab759;p=TP_POO.git Make the "else if" more logic regarding the conditions. Signed-off-by: Jérôme Benoit --- 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) {