BinaryTree
BinaryTree
LinkedList;
import java.util.Queue;
}
public void delete(int key) {
root = delete(root, key);
}
root.data = minValue(root.right);
return root;
}
while (!queue.isEmpty()) {
TreeNode currentNode = queue.poll();
System.out.print(currentNode.data + " ");
if (currentNode.left != null) {
queue.add(currentNode.left);
}
if (currentNode.right != null) {
queue.add(currentNode.right);
}
}
}
}