链表是否有环
p1 = p2 = h; do{ p1 = p1 ->next; p2 = p2 ->next ->next; }while(p2||p2->next||p1 == p2); if(p1 == p2) return true; eles return false;
网站标题:链表是否有环
文章网址:http://azwzsj.com/article/jjdppd.html
p1 = p2 = h; do{ p1 = p1 ->next; p2 = p2 ->next ->next; }while(p2||p2->next||p1 == p2); if(p1 == p2) return true; eles return false;