求大神给个单链表的就地逆置 要不开拓辅助空间 原谅我没有C币
2条回答 默认 最新
cxsmarkchan 2016-03-17 07:20关注struct Node{ int value; Node *next; }; void reverse(Node* head){ Node *prev, *cur, *next; cur = head; prev = NULL; while(cur != NULL){ next = cur->next; cur->next = prev; prev = cur; cur = next; } }本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报