1.

Explain How To Find Whether The Linked List Has A Loop?

Answer»

To know whether the LINKED list has a LOOP, we will take two POINTER approaches. If we MAINTAIN two pointers, and we increase one pointer after PROCESSING two nodes and other after processing every node, we are likely to encounter a situation where both the pointer will be pointing to the same node. This will only occur if linked list has a loop.

To know whether the linked list has a loop, we will take two pointer approaches. If we maintain two pointers, and we increase one pointer after processing two nodes and other after processing every node, we are likely to encounter a situation where both the pointer will be pointing to the same node. This will only occur if linked list has a loop.



Discussion

No Comment Found