虽然结构是值类型,但在语法上常常可以把它们当作类来处理。例如,在上面的 Dimensions
类的定义中,可以编写下面的代码:Dimensions point = new Dimensions();point.Length = 3;point.Width
= 6;注意,因为结构是值类型,所以new ...
分类:
其他好文 时间:
2014-05-15 15:32:03
阅读次数:
300
Sometime, we need to open a file or buffer which name began with current word in emacs.
Here I give the solution as follows.
(provide 'quick-file-jump)
(defun ab/quick-buffer-jump ()
"Quickly jum...
分类:
其他好文 时间:
2014-05-15 15:02:20
阅读次数:
373
【题目】
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring is "b", with the len...
分类:
其他好文 时间:
2014-05-15 14:40:14
阅读次数:
320
为了效率,copy算法可谓无所不用其极,通过分析copy算法能够体会STL的精妙。
首先是三个对外接口:
template // 泛化版本
inline OutputIterator copy(InputIterator first, InputIterator last,
OutputIterator result)
{
...
分类:
其他好文 时间:
2014-05-15 05:50:02
阅读次数:
315
【题目】
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.
【题意】
题意是找出字符串S中最长回文子串,S最长为1000,保证有唯一解
【思路】
原字符串用特殊字符#间隔,如下所示:
#a...
分类:
其他好文 时间:
2014-05-15 03:31:25
阅读次数:
299
题意:给一个整数序列(可能有负数),求最短的连续序列使得序列之和大于等于整数x;
解法:第一种是On的复杂度:
我们要的是sum[j]-sum[i]>=x,如果有两个决策j = sum[j'],那么j就是没用的。即维护一个sum[j]递增序列。然后每次可以二分查找,但是这里有个特点就是要得到最近的,可以同时维护一个left指针,left指针用于跟进更...
分类:
其他好文 时间:
2014-05-15 03:20:26
阅读次数:
303
即使使用编译程序提供的所有警告设施,编译程序所发现的错误,也只是程序错误中的一小部分。例如
以下一行代码:
strCopy=memecpy(malloc(length),str,length));
当malloc 调用失败时,返回一个空指针,而memcpy如果没有处理空指针时,程序就会出现错误。编译程序是无法查出
这种或其他类似的错误。同样编译程序也无法查出算法的错误,...
分类:
编程语言 时间:
2014-05-14 14:11:31
阅读次数:
474
if($el.next().length===0){//结束的代码}for eg: list item
1 list item 2 list item 3 list item 4 list item 5
分类:
Web程序 时间:
2014-05-14 11:44:32
阅读次数:
516
最近在看Jdk6中String的源码的时候发现String的有个这样的构造方法,源代码内容如下:public String(String original)
{ int size = original.count; char[] originalValue = original.value; cha...
分类:
其他好文 时间:
2014-05-14 11:34:24
阅读次数:
274