三个指针,就是比较容易糊涂,要想清楚public class Solution { public void sortColors(int[] A) { if(A==null || A.length0 && A[p2]==2){ p2--; } ...
分类:
其他好文 时间:
2015-04-16 12:01:47
阅读次数:
146
/// /// Double-Checked Locking implements a thread-safe singleton class/// public sealed class Singleton{ private static Singleton _instance = null; /...
分类:
其他好文 时间:
2015-04-16 12:00:57
阅读次数:
118
1.内连接 如图: 关键字 inner join2.外连接 分为左外连接 和右外连接,即如果是左外连接,即使左面没有值,也会显示为null, 右外连接也如此 关键字 left join ; right join全外连接同上。关键字 full join
分类:
数据库 时间:
2015-04-16 11:59:54
阅读次数:
146
首先我们建立一张带有逗号分隔的字符串。 CREATE TABLE test(id int(6) NOT NULL AUTO_INCREMENT,PRIMARY KEY (id),pname VARCHAR(20) NOT NULL,pnum VARCHAR(50) NOT NULL); 然后插入带有逗号分隔的测试数据 IN...
分类:
数据库 时间:
2015-04-16 10:37:31
阅读次数:
184
Server version: 5.5.33-31.1-log Percona Server (GPL), Release rel31.1, Revision 566mysql> CREATE TABLE `t1` ( `ID` int(11) NOT NULL DEFAULT '1', `NA.....
分类:
数据库 时间:
2015-04-16 09:01:33
阅读次数:
291
获取本地时间戳://
//获取时间戳
intgetTimeStamp()
{
timevaltm;
gettimeofday(&tm,NULL);
returntm.tv_sec;//单位:秒
//returntm.tv_usec;//单位:毫秒
}
//
分类:
其他好文 时间:
2015-04-16 06:50:11
阅读次数:
290
1.代码实现如下node* bubble(node* head, int len){ int nVal = 0; node* pCur=NULL; node* pNext=NULL; //外部循环为len for(int i=0; inext; //内部循环逐次减少 for...
分类:
编程语言 时间:
2015-04-16 06:45:27
阅读次数:
166
1.两个链表都带有头结点Node* Merge(Node* head1, Node* head2){ if(head1==NULL || head1->next==NULL) return head2; if(head2==NULL || head2->next==NULL) ret...
分类:
其他好文 时间:
2015-04-16 06:44:16
阅读次数:
110
public class Solution { public String multiply(String num1, String num2) { if(num1==null || num2==null || num1.length()*num2.length()==0) re...
分类:
其他好文 时间:
2015-04-16 06:43:13
阅读次数:
94
Ptr=NULL; //NULL在文件stdio.h中定义过。 Ptr=(unsigned int *)malloc(N*sizeof(int)); //注意一定是要开辟N个int型的字节长度,不然编译会出错。 //printf("%ld\n",Ptr); for(i=0;i { *(Pt...
分类:
其他好文 时间:
2015-04-16 01:30:25
阅读次数:
262