Delete Middle Node

Implement an algorithm to delete a node in the middle of a singly linked list, given only access to that node.


Input: the node c from the linked list a->b->c->d->e
Result: nothing is returned, but the new linked list looks like a->b->d->e




时间复杂度 O(n), 空间复杂度 O(1)


 * Copy the value of the next node to the curNode and delete the next node.
 * This problem cannot be solved if the node to be deleted is the las node
 * in the linked list
public static boolean deleteCurrentNode(Node curNode){
    if (curNode == null || == null){
        return false;
    } =; =;
    return true;