摘要: 如何判断一个单链表是有环的?(注意不能用标志位,最多只能用两个额外指针)typedef struct node{ int ele; struct node * next;}node;bool check( node *head){ node *low=head; node *fast=head; if(head==NULL) return false; while(fast->next!=NULL&&fast!=NULL) { if(fast->ele==low->ele) return true; ... 阅读全文
posted @ 2013-04-13 10:57 小叫花子 阅读(189) 评论(0) 推荐(0) 编辑