有如下一个 Map 对象:HashMap map = new HashMap();map.put(3,"A");map.put(2,"B");map.put(1,"C");键值排序第一种方法:Object[] key = map.keySet().toArray(); Arrays.sort(k.....
分类:
移动开发 时间:
2014-09-04 11:43:19
阅读次数:
250
public class Solution { public void sortColors(int[] A) { for (int i=0,j=0,k=A.length-1; j<=k; ) { if (A[j] == 0) { ...
分类:
其他好文 时间:
2014-09-04 01:31:09
阅读次数:
202
重跑这3天的数据执行过程和遇到的问题:①执行 shsiteKeyDataNew.sh 3 20140801 ;错误提示:awk: cmd. line:39: fatal: cannot open file `../data_today/row_data_20140801*' for reading ...
分类:
其他好文 时间:
2014-09-03 21:09:57
阅读次数:
201
#!/bin/bash log_path="./log/"dates=`date -d '-1 days' +'%Y%m%d'`cd $log_path;for i in `cat list`;do wget $i:/home/work/odp/log/search/search.log.${dat...
分类:
其他好文 时间:
2014-09-03 21:06:27
阅读次数:
205
Sort a linked list in O(n log n) time using constant space complexity. 1 package SortList; 2 3 import java.util.Iterator; 4 5 class ListNode { 6 7 ...
分类:
编程语言 时间:
2014-09-03 21:00:47
阅读次数:
291
1、利用sort进行由小到大排序;
2、利用sort进行由大到小排序;
3、利用sort对结构体一级排;
4、利用sort对结构体二级排序。...
分类:
其他好文 时间:
2014-09-03 18:11:39
阅读次数:
187
思路: 1. 类似快排,走两遍(v=1, 分出0;v = 2,分出1)。 2. 计数排序。计数与重写。
思路:递归,每层从前往后逐步取元素。
分类:
其他好文 时间:
2014-09-03 18:06:26
阅读次数:
278
选择排序(Selection sort)是一种简单直观的排序算法。它的工作原理如下。首先,在未排序序列中找到最小(大)元素,存放到排序序列的起始位置,然后,再从剩余未排序元素中继续寻找最小(大)元素,然后放到已排序序列的末尾。以此类推,直到所有元素均排序完毕。如,有一个数组为 int[] arrs=...
分类:
编程语言 时间:
2014-09-03 16:42:46
阅读次数:
218
Sort ColorsGiven an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the or...
分类:
其他好文 时间:
2014-09-03 16:40:46
阅读次数:
231
在学些shell的 grep, awk, sed 中,发现书中用大多都是单引号. 一开始我总在寻思,为什么用单引号,明明双引号也是行的呀. 中倒是说过:单引号 中的特殊字符失去了特殊意义. 当时也就有那么个印象,记没那么深刻.实践用到的时候,方才知道. 所以,我觉得,如果需要匹配特殊字符...
分类:
其他好文 时间:
2014-09-03 16:21:36
阅读次数:
205