码迷,mamicode.com
首页 > 其他好文 > 详细

Summary For the LinkList

时间:2015-04-14 09:48:06      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

Keep in mind that there are two ways to deal with the LinkList very easily. 
 
1. Using the vector to store every item of the list, then we can use the index of the vector to operate the link. That helps a lot.
 
2. Using three pointers and should understand the theory.(pre, start, then) 
start is the beginning that we will reverse at the list. 
 
1-2-3-4  pre = 1, start = 2, then = 3
把then 插入到pre的后面,pre不动,then始终在放到start的后面.
start.next = then.next //把then先拿出来
then.next = pre.next //把then在新位置上前后相连
pre.next = then. // then的前面
then = start.next // then  重新放到start的后面  

Summary For the LinkList

标签:

原文地址:http://www.cnblogs.com/zhuguanyu33/p/4423941.html

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