1
2
3
4
5
6
7
8
9
10
11
12
13
14 |
Node* findMid(Node* &head) { if (head == NULL||head->next == NULL) return
head; Node* p = head; Node* q = head; while (q->next->next&&(q = q->next)) { p = p-> next; q = q->next; } return
p; } |
求单链表的中间节点,用快慢指针,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/cliviazhou/p/3777624.html