http://www.geeksforgeeks.org/write-a-function-to-reverse-the-nodes-of-a-linked-list/
看到这个递归程序(C语言)扭转单向链表。
void recursiveReverse(struct node** head_ref){
struct node* first;
struct node* rest;
/* empty list */
if (*head_ref == NULL)
return;
/* suppose first = {1, 2, 3}, rest = {2, 3} */
first = *head_ref;
rest = first->next;
/* List has only one node */
if (rest == NULL)
return;
/* reverse the rest list and put the first element at the end */
recursiveReverse(&rest);
first->next->next = first;
/* tricky step -- see the diagram */
first->next = NULL;
/* fix the head pointer */
*head_ref = rest;}
在此步骤中该程序,
/* reverse the rest list and put the first element at the end */
recursiveReverse(&rest);
first->next->next = first;
我可以写 “休息 - >下一=第一;” 代替 “一线>下一步 - >下一=第一;”?
或者是否有写“first-> next-> next = first;”的意义?
http://stackoverflow.com/questions/37725393/reverse-linked-list-recursively – BLUEPIXY