摘要: (1)为什么一定是三次握手,从双方的角度看,都必须构成回路,且三次为最少,所以不是两次也不是四次或以上。 (2)为什么是四次挥手,从双方的角度看,都必须构成回路,且是分别发出信号。 阅读全文
posted @ 2016-09-29 09:46 得江山者得美人 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 1.HashMap引发的 (1)基于散列表实现。 (2)阈值=table数组长度*扩容因子。 (3)线程非安全。 阅读全文
posted @ 2016-09-28 23:38 得江山者得美人 阅读(94) 评论(0) 推荐(0) 编辑
摘要: (1)结构上的: ArrayList,动态数组;LinkedList,双向链表。 (2)性能上的: ArrayList,在查找上有优势;LinkedList,在插入和删除上有优势。 阅读全文
posted @ 2016-09-28 23:27 得江山者得美人 阅读(134) 评论(0) 推荐(0) 编辑
摘要: (1)双检查 if(instance == null){//一次检查 synchronized (MySingleton.class) { if(instance == null){//二次检查 instance = new MySingleton(); } } (2)静态代码块 private s 阅读全文
posted @ 2016-09-28 09:59 得江山者得美人 阅读(237) 评论(0) 推荐(0) 编辑
摘要: Java代码: public static int KMP_Index(char [] s , char [] t){ int [] next = next(t); int i=0,j=0; while(i<s.length&&j<t.length){ if(j 1||s[i]==t[j]){ i+ 阅读全文
posted @ 2016-09-28 09:42 得江山者得美人 阅读(128) 评论(0) 推荐(0) 编辑
摘要: A B C A A C B B C B A D A A B C A C B D 原始 0 0 0 0 1 1 0 0 0 0 0 1 0 1 1 2 3 4 0 0 优化 -1 0 0 -1 1 1 0 0 0 0 -1 1 -1 1 0 0 -1 4 0 0 Java代码: public stat 阅读全文
posted @ 2016-09-28 09:37 得江山者得美人 阅读(171) 评论(0) 推荐(0) 编辑
摘要: int nCurSum=0; int nGreatestSum=-2147483648; for(int i=0;inGreatestSum) nGreatestSum=nCurSum; } 阅读全文
posted @ 2016-09-28 08:10 得江山者得美人 阅读(101) 评论(0) 推荐(0) 编辑
摘要: public static int [] rad(String str){ StringBuilder newStr= new StringBuilder(); newStr.append('#'); for(int i=0;i<str.length();i++){ newStr.append(st 阅读全文
posted @ 2016-09-26 20:52 得江山者得美人 阅读(195) 评论(0) 推荐(0) 编辑
摘要: for(int i=0;i<nums.length;i++){ int component = target-nums[i]; if(map.containsKey(component)) return new int[]{map.get(component),i}; map.put(nums[i] 阅读全文
posted @ 2016-09-26 18:03 得江山者得美人 阅读(182) 评论(0) 推荐(0) 编辑
摘要: int nCurSum=0; int nGreatestSum=-2147483648; for(int i=0;i<pDate.length;i++){ if(nCurSum<=0) nCurSum=pDate[i]; else nCurSum+=pDate[i]; if(nCurSum>nGre 阅读全文
posted @ 2016-09-26 17:48 得江山者得美人 阅读(114) 评论(0) 推荐(0) 编辑