Write an algorithm to delete a node in a singly Linked List with access to that node only.
Since we have only access to the node to be deleted (let's call it current node) and this is a singly Linked List, the pointer to the previous node of the current node is not available. The below algorithm is not applicable if the current node is the last node of the Linked List. The algorithm works as :
public static boolean deleteNodeInASinglyLL(Node node){ |