码迷,mamicode.com
首页 >  
搜索关键字:Arrays    ( 3585个结果
LeetCode 2.Median of Two Sorted Arrays
#include#includeusing namespace std;class Solution {public: double findMedianSortedArrays(int A[], int m, int B[], int n) { int findNum...
分类:其他好文   时间:2014-12-28 19:30:53    阅读次数:85
java 列表、集合与数组之间的转化
import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; public clas...
分类:编程语言   时间:2014-12-27 17:19:52    阅读次数:207
Cracking the coding interview汇总目录
很久之前刷的CTCI的题目,都快忘记了,做个分类汇总,再重新好好复习一遍。 Chapter 1 | Arrays and Strings 1.1 Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data stru...
分类:其他好文   时间:2014-12-26 20:20:00    阅读次数:452
Java中Comparable和Comparator实现对象比较
当需要排序的集合或数组不是单纯的数字型时,通常可以使用Comparator或Comparable,以简单的方式实现对象排序或自定义排序。下面通过两个例子分别用Comparable和Comparator实现对User对象中年龄排序。 1.通过实现Comparable接口,根据User的年龄进行排序。 import java.util.Arrays; /** * @aut...
分类:编程语言   时间:2014-12-26 16:48:36    阅读次数:123
使用observable数组(Working with observable arrays)
observable数组(observable arrays)如果你要探测和响应一个对象的变化,你应该用observables。如果你需要探测和响应一个集合对象的变化,你应该用observableArray 。在很多场景下,它都非常有用,比如你要在UI上需要显示/编辑的一个列表数据集合,然后对集合进...
分类:编程语言   时间:2014-12-25 20:02:45    阅读次数:248
改善java程序的151个建议--数组和集合
60、性能考虑,数组是首选,在基本类型处理方面,数组还是占优势的,而且集合类的底层也都是通过数组实现,建议在性能要求较高的场景中使用数组替代集合。 61、如果有必要,使用变长数组:我们可以通过对数组扩容”婉转”地解决数组扩容问题,下面采用的是Arrays数组工具类的copyOf方法,产生了一个newLen长度的新数组,并把原有的值拷贝了进去,之后就可以对超长的元素进行赋值了 62、警惕数组...
分类:编程语言   时间:2014-12-24 10:04:24    阅读次数:269
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 O(log (m+n)). Show Tags...
分类:其他好文   时间:2014-12-24 01:16:15    阅读次数:148
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-12-23 23:49:51    阅读次数:212
【LeetCode】Median of Two Sorted Arrays (2 solutions)
Median of Two Sorted ArraysThere are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run...
分类:其他好文   时间:2014-12-23 19:10:42    阅读次数:174
leetcode. Merge Sorted Array
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...
分类:其他好文   时间:2014-12-22 19:18:27    阅读次数:180
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!