第一讲 泛型(Generic)一、概述1、JDK1.5版本以后出现的新特性。用于解决安全问题,是一个类型安全机制。2、JDK1.5的集合类希望在定义集合时,明确表明你要向集合中装入那种类型的数据,无法加入指定类型以外的数据。3、泛型是提供给javac编译器使用的可以限定集合中的输入类型说明的集合时,...
分类:
编程语言 时间:
2015-01-15 21:36:03
阅读次数:
326
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/42744709
Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
思路:
(1)如果不知道anagrams的意思,很容易将题意理解错了。最开始...
分类:
其他好文 时间:
2015-01-15 20:27:31
阅读次数:
259
http://www.hankcs.com/nlp/corpus/several-revenue-segmentation-system-used-set-of-source-tagging.html我发现几个民间的分词项目的词典很乱,ansj分词的作者承认arrays.dic是从结巴分词抄过来的,...
分类:
其他好文 时间:
2015-01-15 12:35:19
阅读次数:
280
private int count;//计数器private int ary[] = new int [3];if(count >= ary.length){ //数组动态扩展 int newlen = (ary.length*3)/2 + 1; underwears = Arrays...
分类:
编程语言 时间:
2015-01-14 21:13:17
阅读次数:
236
题目
Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note: You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements ...
分类:
其他好文 时间:
2015-01-14 16:54:36
阅读次数:
183
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ...
分类:
其他好文 时间:
2015-01-14 00:42:38
阅读次数:
278
Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from ...
分类:
其他好文 时间:
2015-01-13 17:51:17
阅读次数:
180
原题链接:https://oj.leetcode.com/problems/median-of-two-sorted-arrays/
这是一道比较搞脑子的一道题,细节较多。
1. 这里用到的是findKth的思想,就是如果一共有奇数个元素,假设一共有t个元素,则中间元素为第t / 2 + 1个最大的,如果是偶数,则是t / 2位置和t / 2 + 1位置的平均数。
2. 关于find...
分类:
其他好文 时间:
2015-01-13 17:41:54
阅读次数:
108
Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from ...
分类:
编程语言 时间:
2015-01-12 21:01:06
阅读次数:
280
找到两个已排序数组的中间值,如输入{2,3,5},{4,6},输出4,若输入{2,3,5},{4,6,8},则输出4.5。因为是两个已排序数组,我想到的是用归并排序的思想,排序后数组中间的那个数,或中间两个数的平均数即为所求的median。
{CSDN:CODE:577991}...
分类:
其他好文 时间:
2015-01-12 16:31:23
阅读次数:
186