首页 > 其他 > 详细

Summary For the LinkList

时间:2015-04-14 09:45:13      阅读:111      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!