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