1.

Tell How To Check Whether A Linked List Is Circular ?

Answer»

Create TWO POINTERS, each set to the START of the LIST. Update each as follows:

while (pointer1) { pointer1 = pointer1->next; pointer2 = pointer2->next; if(pointer2)pointer2=pointer2->next; if (pointer1 == pointer2) { print (”circularn”); } }

Create two pointers, each set to the start of the list. Update each as follows:



Discussion

No Comment Found