Sort a linked list using insertion sort.思路:插入排序#include using namespace std;struct ListNode { int val; ListNode *next; ListNode(int x): val(x...
分类:
其他好文 时间:
2014-09-22 03:01:31
阅读次数:
159
Where is the Marble?
Where is the Marble?
Raju and Meena love to play with Marbles. They have got a lot of marbles with numbers written on them. At the beginning, Raju wou...
分类:
其他好文 时间:
2014-09-22 01:04:21
阅读次数:
477
// Array对象
// 第一种构造方法
var arr = new Array();
alert(arr.length);
arr[0] = 520 ;
arr[1] = "wjp" ;
alert(arr.length);
// 第二种构造方法
// Array(4) ;
// 第三种构造方法
// Array(520, "wjp", 13...
分类:
编程语言 时间:
2014-09-21 23:42:01
阅读次数:
357
Linux sort命令用于将文本文件内容按某种方式排序,默认是ASCII码方式:
语法说明:
sort[-bcdfimMnur][-o][-t][-k][文件]
常用参数:
-b 忽略每行前面开始出的空格字符。
-c 检查文件是否已经按照顺序排序。
-d 排序时,处理英文字母、数字及空格字符外,忽略其他的字符。
-f 排序时,将小写字母视为大写字母。
-i 排序时,除了040至176之间的ASCII字符外,忽略其他的字符。
-m 将几个排序好的文件进行合并。
-M 将前...
分类:
系统相关 时间:
2014-09-21 21:56:21
阅读次数:
398
//插入排序(一维数组)//插入排序(Insertion Sort)的基本思想是:每次将一个待排序的记录,按其关键字大小插入到前面已经排好序的子文件中的适当位置,直到全部记录插入完成为止。function insert_sort($arr){ $count=count($arr); for($i=1...
分类:
其他好文 时间:
2014-09-21 21:41:31
阅读次数:
259
#! /bin/sh
while true;
do
i=`df -h | egrep '/mnt/D'| awk '{print $5}' | cut -d "%" -f1 -`
if [ "$i" -ge 90 ]
then
echo "disk nearly full"
cd /mnt/D/files/
for file1day in `ls -d */ | sort -n...
分类:
系统相关 时间:
2014-09-21 00:00:59
阅读次数:
276
Compare methodEither you implement a compare-method for your object:- (NSComparisonResult)compare:(Person *)otherObject { return [self.birthDate co...
分类:
其他好文 时间:
2014-09-20 23:09:39
阅读次数:
263
Sort a linked list inO(nlogn) time using constant space complexity.思路:采用归并排序或者快速排序#include using namespace std;struct ListNode { int val; ListNo...
分类:
其他好文 时间:
2014-09-20 20:12:09
阅读次数:
230
TBOX提供了各种常用算法,对容器中的元素进行各种操作,这里主要介绍下排序和查找算法。 排序算法目前支持如下几种: 1. 快速排序:tb_quick_sort 2. 堆排序: tb_heap_sort 3. 插入排序:tb_bubble_sort 4. 冒泡...
分类:
其他好文 时间:
2014-09-20 19:38:49
阅读次数:
183
构造TreeMap可以指定Comparator,但是不能对value字段进行排序。如果有需求对Value字段排序,例如map存放的是单词,单词出现次数,怎么按单词次数排序呢? 可以先将map中的key-value放入list,然后用Collections.sort对list排序,再将排序后的l...
分类:
编程语言 时间:
2014-09-20 19:05:39
阅读次数:
196