What does the following program do on the singly linked list?

p=head;
q=head->next;
while(p!=null && q!null)
{
if(p==q)
{
exit(0)
}
p=p->next;
q=(q->next)?(q->next->next):q->next;
}

a)traverse the entire singly linked list
b)detects the duplicate nodes
c)detects the loop in singly linked list
d)detects the duplicate nodes at alternate places

plz explain anyone with correct option..........

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to