Collections的sort方法代码: public static void sort(List list, Comparator c) { Object[] a = list.toArray(); Arrays.sort(a, (Comparator)c); ListIterator i = list.listIterator(); for (int j=0; j i.next...
分类:
其他好文 时间:
2014-07-29 22:08:52
阅读次数:
364
package datastruct;
import java.util.Arrays;
/**
* 用数组模拟栈的结构:后进先出(LIFO) 线性表结构
* @author stone
* 2014-07-29 06:34:49
*/
public class SimulateStack {
public static void main(String[] args) {...
分类:
其他好文 时间:
2014-07-29 22:04:42
阅读次数:
359
基本原理:事先准备好一个固定长度的数组。如果长度不够的时候,realloc一块区域。另外:在数组元素减少的情况下,需要缩减数组长度。...
分类:
编程语言 时间:
2014-07-29 14:17:08
阅读次数:
301
这是比赛后打的题目,思路很清晰:申明一个结构体,将输入的数复制在这个结构体数组中,排序后比对下标,找到变动的首下标和尾下标,再看这段是否逆序了。Being a programmer, you like arrays a lot. For your birthday, your friends hav...
分类:
其他好文 时间:
2014-07-29 11:59:56
阅读次数:
267
题目: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 e....
分类:
编程语言 时间:
2014-07-28 14:47:23
阅读次数:
1108
题目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 b...
分类:
其他好文 时间:
2014-07-27 22:49:39
阅读次数:
176
DescriptionBeing a programmer, you like arrays a lot. For your birthday, your friends have given you an arrayaconsisting ofndistinctintegers.Unfortuna...
分类:
其他好文 时间:
2014-07-27 22:27:19
阅读次数:
219
一、原题DescriptionBeing a programmer, you like arrays a lot. For your birthday, your friends have given you an arrayaconsisting ofndistinctintegers.Unfor...
分类:
其他好文 时间:
2014-07-27 22:22:59
阅读次数:
317
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-07-27 09:53:12
阅读次数:
350
Merge Sorted ArrayGiven 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 i...
分类:
其他好文 时间:
2014-07-25 02:34:44
阅读次数:
162