Consider the following code which is used to detect the loop in the linked list. Find the missing statement A?

p = head;

q = head->next;

while(A)

{

    if(p == q) exit(0) //loop detected

    p = p->next;

    q = (q->next)?(q->next->next) : q->next;

}

1
(p!=NULL) || (q!=NULL)
2
p!=NULL
3
q!=NULL
4
(p!=NULL) && (q!=NULL)

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation