This commit is contained in:
Marcos 2017-12-16 12:37:30 +01:00
parent 7acbc7902d
commit 959845621f
1 changed files with 3 additions and 3 deletions

View File

@ -82,7 +82,7 @@ public class BinaryTree {
} }
// Case 3: 2 children // Case 3: 2 children
int smallestValue = findSmallestNode(current.right); int smallestValue = findSmallestValue(current.right);
current.value = smallestValue; current.value = smallestValue;
current.right = deleteRecursive(current.right, smallestValue); current.right = deleteRecursive(current.right, smallestValue);
return current; return current;
@ -96,13 +96,13 @@ public class BinaryTree {
} }
} }
private int findSmallestNode(Node root) { private int findSmallestValue(Node root) {
if (root.left == null) { if (root.left == null) {
return root.value; return root.value;
} }
return findSmallestNode(root.left); return findSmallestValue(root.left);
} }
public void traverseInOrder(Node node) { public void traverseInOrder(Node node) {