BSTnode delete(BSTnode node, Comparable value){
    if(node == null){
      return null;
    }
    lastNode = node;
    if(value.compareTo(node.data)<0){
      node.left = delete(node.left,value);
    }
    else{
      delNode = node;
      node.right = delete(node.right,value);
    }
    
    if(node == lastNode){
      if(delNode != null && value.equals(delNode.data)){
        if(delNode == lastNode){
          node = node.left;
        }
        else{
          swapData(delNode,lastNode);
          node = node.right;
        }
      }
    }
    return node;
  }