码迷,mamicode.com
首页 > 编程语言 > 详细

数据结构与算法 —— 单向链表的逆转

时间:2018-09-29 22:48:40      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:图片   eve   alt   nbsp   return   color   数据结构   bubuko   inf   

技术分享图片

 

 

 1 List Reverse(List L)
 2 {
 3     Node *new_head, *old_head, temp;
 4     new_head = NULL;
 5     old_head = L;
 6     while(old_head)
 7     {
 8         temp = old_head->next;
 9         old_head->next = new_head;
10         new_head = old_head;
11         old_head = temp;
12     }
13     
14     L = new_head;
15     return L;
16 }

 

数据结构与算法 —— 单向链表的逆转

标签:图片   eve   alt   nbsp   return   color   数据结构   bubuko   inf   

原文地址:https://www.cnblogs.com/FengZeng666/p/9726843.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!