Question d’entretien chez ASSA ABLOY Group

How to detect loop in a link list?

Réponse à la question d'entretien

Utilisateur anonyme

16 déc. 2018

Use 2 pointers. The first is advance 1 node step, the seconds advanced 2 nodes steps each iteration. If the 2 pointers are equal than it mean loop detected.