题目:
Given a singly linked list, determine if it is a palindrome.
Follow up:
Could you do it in O(n) time and O(1) space?
题解:
判断一个链表是不是回文的,这里要求O(n)时间复杂度和O(1)的空间时间复杂度,总共想了三种办法,三种办法都用到了两个指针,符合...
分类:
编程语言 时间:
2015-07-29 12:13:09
阅读次数:
136
题意:将指定的一段位置[m,n]的链表反置,返回链表头。思路:主要麻烦在链表头,如果要从链表头就开始,比较特殊。 目前用DFS实现,先找到m-1的位置,再找到n+1的位置,中间这段就是否要反置的,交给DFS解决,用个计数器来统计已经反置的个数即可。 1 /** 2 * Definition fo.....
分类:
其他好文 时间:
2015-07-29 12:05:09
阅读次数:
85
About Information Property List FilesUILaunchImageFileUILaunchImageFile (String - iOS) specifies the name of the launch image file for the app on olde...
分类:
移动开发 时间:
2015-07-29 12:00:49
阅读次数:
189
1、redis简介redis是一个key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set --有序集合)和hashs(哈希类型)。这些数据类型都支持push/pop、add...
转自http://blog.csdn.net/ccf07031、所需的软件下载及安装所需工具下载地址:msysgit http://code.google.com/p/msysgit/downloads/list?q=full+installer+official+gitcopssh http:.....
分类:
其他好文 时间:
2015-07-29 11:41:11
阅读次数:
164
问题来源:在和一位技术老师聊天时,老师问我一个mvc 表单提交的问题,问道:怎样在表单提交的时候,将 带有 List 属性的对象传入控制器?这时,我有点呆了,以前一直都好像是 单一属性的表单提交,没有做过 带有list属性 的表单提交。最后饶了一圈,还是老老实实回答老师,不知道,没有处理过。既然问题...
分类:
其他好文 时间:
2015-07-29 11:34:52
阅读次数:
121
题目:
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node
...
分类:
编程语言 时间:
2015-07-29 10:22:45
阅读次数:
207
#include #include #include #include using namespace std;void print(vector& list, const string &des){ cout::iterator iter = list.begin(); iter != list....
分类:
编程语言 时间:
2015-07-29 10:10:53
阅读次数:
134
.Net Framework为动态列表提供了泛型类List,这个类实现了IList、ICollection、IEnumerable、IList、ICollection、IEnumerable接口。
ICollection接口:
ICollection接口由泛型集合类实现。使用这个接口可以获得集合中的元素个数(count属性),把集合复制到数组中(copyto()方法),还可以从集合中添...
‘red‘,‘blue‘,‘green‘,‘yellow‘$colors=array(‘red‘,‘blue‘,‘green‘,‘yellow‘);while(list($key,$val)=each($colors)){$x=$colors;//赋任意指针回到开始位置echo"$key=>$val<br/>";
分类:
其他好文 时间:
2015-07-29 06:53:20
阅读次数:
165