Is it possible to delete a middle node in the single linked list when the only information available we have is the pointer to the node to be deleted and not the pointer to
Considering below linked list
1 -> 2 -> 3 -> NULL Pointer to node 2 is given say "ptr".
1 -> 2 -> 3 -> NULL
Pointer to node 2 is given say "ptr".
We can have pseudo-code which looks something like this:
struct node* temp = ptr->next; ptr->data = temp->data; ptr->next = temp->next; free(temp);