Binary Search Tree delete function I have implemented this delete function for BST. Tt takes care of all the three cases, deleting node with 0, 1, or 2 children.

I have added comments throughout to explain my decisions. Is it sloppy or acceptable? Will I get full marks if this was a question in an exam to implement the delete function of a BST?

//I am having the node start parameter, so I can specify from where the
//deletion starts. So I can use it for recursion for the third case,
//where the node to be deleted has 2 children.
public void delete(Node start, int data) {
    if(root == null) return;

    /*If I want to call this method from any other class, I will pass in
    null as the start node, since I don't have reference to the root in 
    that class.
    I have this start parameter because in the case of a node having 2
    children, I am calling this method recursivly to delete, but I don't
    want to start from the root in that case. See below, last else */
    Node parent = start == null ? root : start;
    Node current = parent;
    boolean isLeftNode = false;

    while(data != current.getData() &amp;&amp; current != null) {
        parent = current;

        if(data &lt; current.getData()) {
            current = current.getLeftNode();
            isLeftNode = true;
        }
        else {
            current = current.getRightNode();
            isLeftNode = false;
        }
    }

    //If not found.
    if(current == null) return;

    if(current == root) {
        root = null;
        return;
    }
    //Case 1: If node to be removed is a leaf, no children.
    if(current.getLeftNode() == null &amp;&amp; current.getRightNode() == null) {
        if(isLeftNode)
            parent.setLeftNode(null);
        else
            parent.setRightNode(null);
    }
    //Case 2: If node to be removed has only 1 child.
    else if(current.getLeftNode() != null &amp;&amp; current.getRightNode() == null) {
        if(isLeftNode)
            parent.setLeftNode(current.getLeftNode());
        else
            parent.setRightNode(current.getLeftNode());
    }
    else if(current.getLeftNode() == null &amp;&amp; current.getRightNode() != null) {
        if(isLeftNode)
            parent.setLeftNode(current.getRightNode());
        else
            parent.setRightNode(current.getRightNode());
    }
    //Case 3: If node to be deleted has 2 children.
    else {
        Node smallest = findSmallest(current.getRightNode());
        current.setData(smallest.getData());
        //Calling recursion to delete the smallest. Because the smallest
        //might have a right subtree. Explanation above relates to this.
        delete(current.getRightNode(), smallest.getData());
        //Calling the delete method to start deleting from the right sub
        //tree since at this point there is a duplicate value, I can't
        //start from the root.
    }
}

public Node findSmallest(Node start) {
    //This is so in the main method, I can call findSmallest and pass in
    //null to search the whole tree. Because in main, I won't have reference
    //to the root. I have the start parameter so I can specifiy where to
    //start the search, because of the way I am dealing with deleting
    //a node with 2 children. See above.
    Node smallest = start == null ? root : start;

    while(smallest.getLeftNode() != null) {
        smallest = smallest.getLeftNode();
    }
    return smallest;
}
public Node findSmallest(Node start) {
    //This is so in the main method, I can call findSmallest and pass in
    //null to search the whole tree. Because in main, I won't have reference
    //to the root. I have the start parameter so I can specifiy where to
    //start the search, because of the way I am dealing with deleting
    //a node with 2 children. See above.
    Node smallest = start == null ? root : start;

    while(smallest.getLeftNode() != null) {
        smallest = smallest.getLeftNode();
    }
    return smallest;
}



I would break this into two methods:  

public Node findSmallest() {
    return findSmallest(root);
}

private Node findSmallest(Node candidate) {
    // I have the start parameter so I can specify where to
    // start the search, because of the way I am dealing with deleting
    // a node with 2 children. See above.
    while (candidate.getLeftNode != null) {
        candidate = candidate.getLeftNode();
    }

    return candidate;
}


Now your external caller isn't asked to pass information that it doesn't have.  And you don't have to check whether the method is being called internally or externally on every call.  

I prefer the name candidate to smallest for accuracy's sake.  Until the last iteration, it's not the smallest.  It's a candidate to be the smallest on every iteration.  


    }
    //Case 3: If node to be deleted has 2 children.
    else {



I'm not a fan of the half-cuddled else in the first place, but if you have to use it, please use it without separation.  It's bad enough that C-style languages (e.g. Java) do not explicitly end their if/then blocks.  Adding arbitrary content between the then block and the else just makes this worse.  

    }
    else {
        // Case 3: If node to be deleted has 2 children.


Now I can easily see that there is an else.  I don't have to scroll down to the next statement to see if it might be an else.  

Also, there are four cases, not three.  Your case 2 is two cases:  a null left child or a null right.  


    while(data != current.getData() &amp;&amp; current != null) {



This is a bug.  Create a test case where the data is not found and you'll see.