通过阅读 java.util.Arrays,学习Java标准库中操作数组的函数,包括各种排序算法如何对排序进行优化,二分搜索,哈希值计算等等 。...
分类:
其他好文 时间:
2014-06-09 23:26:14
阅读次数:
248
题目
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
For example:
G...
分类:
其他好文 时间:
2014-06-08 17:29:07
阅读次数:
315
题目
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,
Given n = 3, there are a total of 5 unique BST's.
1 3 3 2 ...
分类:
其他好文 时间:
2014-06-08 17:06:58
阅读次数:
235
在前几个章节中使用了Comparable作为比较函数。比如对于字符串,就是按字母表的顺序进行排序。有时候想要换一种比较方式,该怎么实现呢?
在Java中可以使用Comparator比较器,以下代码展示了字符串之间不同的比较方式。
String[] a;
...
Arrays.sort();
...
Arrays.sort(a, String.CASE_INSENSITI...
分类:
其他好文 时间:
2014-06-08 15:37:08
阅读次数:
201
题目
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.
For example,
Given n = 3, your program should return all 5 unique BST's shown below.
...
分类:
其他好文 时间:
2014-06-08 15:15:26
阅读次数:
223
android传感器的坐标系统和其2D设计并不相同,坐标系如下图:使用SensorManager对象注册传感器监听器后,在onSensorChanged方法内可以得到SensorEvent的一个对象。而SensorEvent对象有一个重要的成员变量public
final float[]values...
分类:
移动开发 时间:
2014-06-08 07:39:57
阅读次数:
302
PathsumDescription:Given a binary tree and a
sum, determine if the tree has a root-to-leaf path such that adding up all the
values along the path equa...
分类:
其他好文 时间:
2014-06-08 01:11:46
阅读次数:
395
package chap04_Divide_And_Conquer;import static
org.junit.Assert.*;import java.util.Arrays;import org.junit.Test;/** * 算反导论第四章
4.1 最大子数组 * * @author ....
分类:
其他好文 时间:
2014-06-07 20:21:38
阅读次数:
212
A basic requirement is that the function should
provide a uniform distribution of hash values. A non-uniform distribution
increases the number of coll...
分类:
其他好文 时间:
2014-06-07 16:58:29
阅读次数:
240
Given a binary tree and a sum, determine if the
tree has a root-to-leaf path such that adding up all the values along the path
equals the given sum.Fo...
分类:
其他好文 时间:
2014-06-07 16:55:09
阅读次数:
173