가능한 중복 : 모든
Best algorithm to test if a linked list has a cycle이 코드가 연결된 목록에서 루프를 찾는 방법은 무엇입니까?
p=head;
q=head->next;
while(p!=NULL && q!=NULL)
{
if(p==q) { //Loop detected! exit(0); }
p=p->next;
q=(q->next)?(q->next->next):q->next; --how this line works ??
}
http://stackoverflow.com/questions/3001695/how-to-determine-whether-a-linked-list-contains-a-loop-closed http://stackoverflow.com/questions/494830/의 중복 링크가있는 경우를 어떻게 결정할 것인가는 사이클을 사용하는 두 개의 메모리가있는 위치 http://stackoverflow.com/questions/2936213/explain-how-finding-cycle-start -node-in-cycle-linked-list-work http://stackoverflow.com/questions/34249/best-algorithm-to-test-if-a-linked-list-has-a-cycle 및 대부분 : http : //stackoverflow.com/search? tab = 관련성 및 질문 = % 20if % 결정 20linked % 20list % 20has % 20a % 20cycle – dmckee