Summary For the LinkList

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的后面

时间: 2024-10-07 06:47:51

Summary For the LinkList的相关文章

【HTML5】summary交互元素

1.源码 <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"/> <title>交互元素summary的使用</title> <style type="text/css"> body{ padding:5px; font-size:14px; } summary{ font-weight:bold; } </style>

HDU 4989 Summary(数学题暴力)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4989 Problem Description Small W is playing a summary game. Firstly, He takes N numbers. Secondly he takes out every pair of them and add this two numbers, thus he can get N*(N - 1)/2 new numbers. Thirdl

228. Summary Ranges

Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. 这个题目不难,首先对原序列进行排序,然后要注意对特殊情况的处理.同时,要掌握string类的几个重要成员函数: to_string():将数字转换为

Learning to Compare Image Patches via Convolutional Neural Networks --- Reading Summary

Learning to Compare Image Patches via Convolutional Neural Networks ---  Reading Summary 2017.03.08 Target: this paper attempt to learn a geneal similarity function for comparing image patches from image data directly. There are several ways in which

LinkList

LinkList:java中jdk1.6之后java.util.LinkList 类中对分装链表的理解: 参考:http://www.cnblogs.com/lintong/p/4374292.html 第一部分:熟悉LinkList中哪些方法和其构造;第二部分熟悉使用JDK中LinkList的API接口 第1部分:LinkList 的介绍: linklist:是一个双向链表,当做堆栈,队列或者双端队列进行操作:当做stack时候只能用push,pop,peek方法:当做队列时候用 add,re

链表中LinkList L与LinkList *L 借鉴

链表中LinkList L与LinkList *L的区别以及(*L).elem,L.elem L->next,(*L)->next的区别typedef struct Node{int elem;struct node * next;}node,*LinkList; 对于LinkList L: L是指向定义的node结构体的指针,可以用->运算符来访问结构体成员,即L->elem,而(*L)就是个Node型的结构体了,可以用点运算符访问该结构体成员,即(*L).elem; 对于Lin

三个不常用的HTML元素:&lt;details&gt;、&lt;summary&gt;、&lt;dialog&gt;

前面的话 HTML5不仅新增了语义型区块级元素及表单类元素,也新增了一些其他的功能性元素,这些元素由于浏览器支持等各种原因,并没有被广泛使用 文档描述 <details>主要用于描述文档或文档某个部分的细节,与<summary>配合使用可以为<details>定义标题.标题是可见的,用户点击标题时,显示出details [注意]这两个标签只有chrome和opera支持 <details> 该标签仅有一个open属性,用来定义details是否可见(默认为不

[LeetCode]228.Summary Ranges

题目 Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. 代码 /*--------------------------------------- * 日期:2015-08-04 * 作者:SJF01

Java for LeetCode 228 Summary Ranges

Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. 解题思路: JAVA实现如下: public List<String> summaryRanges(int[] nums) { List