Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2- ...
分类:
其他好文 时间:
2016-06-02 06:13:20
阅读次数:
189
List 为有序可重复列表 实现List接口的类主要是ArrayList 下面为ArrayList的测试代码 代码分析: 先实例化一个ArrayList的对象a1 向其中加入元素用到add()方法 输出整个列表 然后将集合a1转化成数组,用到toArray()的方法 在计算数组之和的过程中用到了in ...
分类:
编程语言 时间:
2016-06-02 00:37:45
阅读次数:
184
Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be integ ...
分类:
其他好文 时间:
2016-06-02 00:30:07
阅读次数:
163
递归方法,实现查找目录中以.java为后缀的文件路径,并存入文本文件中 定义一个静态方法fileToLine(),传入参数:File对象目录,List集合对象(List<File> 这样做的目的是因为这个方法会被递归,因此不能在内部创建,并且List集合是引用传递) 调用File对象的listFil ...
分类:
编程语言 时间:
2016-06-02 00:25:05
阅读次数:
195
在STL中基本容器有: vector、list、deque、set、map set 和map都是无序的保存元素,只能通过它提供的接口对里面的元素进行访问 set :集合, 用来判断某一个元素是不是在一个组里面,使用的比较少 map :映射,相当于字典 ,把一个值映射成另一个值,如果想创建字典的话使用 ...
分类:
其他好文 时间:
2016-06-01 23:17:27
阅读次数:
383
Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. 交换两个节 ...
分类:
其他好文 时间:
2016-06-01 23:11:14
阅读次数:
145
Arrays:数组类,是包java.util下面的一个类,Collection接口也在这个包下面。 主要的方法: Arrays.asList(数组对象) //此静态方法用于将Array转化为List类型对象。常常用于List类型对象的初始化中。 Arrays.sort(array):升序排序; Ar ...
分类:
编程语言 时间:
2016-06-01 23:08:10
阅读次数:
236
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For ...
分类:
其他好文 时间:
2016-06-01 23:06:55
阅读次数:
164
参考了https://miafish.wordpress.com/2015/07/26/leetcode-ojc-delete-node-in-a-linked-list/ ...
分类:
其他好文 时间:
2016-06-01 23:05:59
阅读次数:
152
Ubuntu下通过安装LSImegaraidmegacli命令行工具可以用来管理硬件磁盘阵列。具体安装步骤如下。1.添加megaraid源:修改/etc/apt/sources.list在末尾添加debhttp://hwraid.le-vert.net/ubuntuprecisemain然后执行:apt-getupdateapt-getinstallmegaclimegactlmegaraid-status如果..
分类:
系统相关 时间:
2016-06-01 21:31:42
阅读次数:
2022