Suppose p and q are 2 nodes in linked list, where p pointing to head node and q pointing to next to head node.
Now, chk this condition
while(A)
{
if(p==q)exit(0);
p=p->next;
q=(q->next)?(q->next->next):q->next;
}
what is the meaning of line
q=(q->next)?(q->next->next):q->next;
Can some body elaborate? Is it mean when q and q->next pointing to the same node, then q pointer should be incremented upto q->next->next?
And what should be value of A, so that this while loop satisfies the condition that this linked list satisfies the condition for a loop?