链表是否有环
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://pwwzsj.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;