Deleting a node in circular linked list in constant time

You are given a circular single linked list of sufficiently many number of nodes(in the millions). You need to delete a node say P and you are given a pointer to P in the circular single list. Suggest the most efficient methodology of deleting the node P from the circular single linked list without rounding about the circular single linked list.

Answer :
Copy the contents of the next node
tmp = cur->next;
cur->next = this->next->next;
delete tmp

No comments: