码迷,mamicode.com
首页 >  
搜索关键字:Arrays    ( 3585个结果
leetcode - Median of Two Sorted Arrays
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 ...
分类:其他好文   时间:2014-09-24 17:45:07    阅读次数:214
数组与集合List的相互转化
数组转化为集合#此运用的是Arrays中的asList方法,返回一个List集合 *当数组元素为基本数据类型是把整个数组当作一个元素放入List集合中,代码举例:int[] a = {1,2,3};List list = Arrays.asList(a);//asList是静态方法 *当数组元素.....
分类:其他好文   时间:2014-09-24 01:58:25    阅读次数:176
找出数组中出现次数超过一半的数字
题目:数组中有一个数字出现的次数超过了数组长度的一半,找出这个数字。 解法1:将数组利用快速排序进行排序,因为数组中有一个数字出现的次数超过了数组长度的一半,则排序以后直接取得最中间的那个数字即可! 时间复杂度为:o(n*logN),因为时间主要花费在快速排序上面了! public static int find1(int[] a) { Arrays.sort(a); int mi...
分类:其他好文   时间:2014-09-23 21:21:55    阅读次数:213
RAID的简单说明
RAID,为Redundant Arrays of Independent Disks的简称,中文为廉价※冗余磁盘阵列。磁盘阵列其实也分为软阵列(Software Raid)和硬阵列(Hardware Raid)两种.软阵列即通过软件程序并由计算机的CPU提供运行能力所成.由于软件程式不是一个完整系...
分类:其他好文   时间:2014-09-22 23:23:33    阅读次数:189
关于json-lib类库的使用
前言介绍:json-lib包是一个Java类库,它可以将Java对象(包括:beans,maps,collections,java arrays ,xml等)和JSON互相转换。与此相同的是谷歌也推出了一个类库叫Gson,这个今天先不讲。准备工作:首先我们需要去下载json-lib的jar包,并导入...
分类:Web程序   时间:2014-09-22 18:57:22    阅读次数:195
swap in java?
Is it possible to write a swap method in java? these two variables will be primitives.It's not possible, without any objects or arrays. (Java passes s...
分类:编程语言   时间:2014-09-20 09:56:07    阅读次数:176
Leetcode: Median of Two Sorted Arrays
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 ...
分类:其他好文   时间:2014-09-20 05:40:07    阅读次数:282
bitVector@ java bit自我practice##Q&A:为何int 来初始化size of bitVector?long,甚至是BigInteger等策略
/* * BitSets are packed into arrays of "words." Currently a word is * a long, which consists of 64 bits, requiring 6 address bits. * The ...
分类:编程语言   时间:2014-09-18 16:08:04    阅读次数:254
java char array杂记
char array转string用Arrays.toString会多出来逗号和大括号 可以用replaceAll方法来取代 但是更好的一种方案是 直接用String类的构造函数char array的默认值是asc 0 而不是' 'asc 32 详情见代码 1 public class Test {...
分类:编程语言   时间:2014-09-18 05:24:43    阅读次数:218
Median of Two Sorted Arrays(Java)
求2个数组的中位数方法很多但是时间复杂度各异1利用数组copy方法先融合两个数组,然后排序,找出中位数import java.lang.reflect.Array;import java.util.Arrays;import java.util.Collection;import java.util...
分类:编程语言   时间:2014-09-18 00:41:02    阅读次数:222
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!