用HTML5实现的各种排序算法的动画比较http://www.webhek.com/misc/comparison-sort/几种排序算法效率的比较来源:http://blog.chinaunix.net/uid-20773165-id-1847742.html1.稳定性比较插入排序、冒泡排序、二叉...
分类:
Web程序 时间:
2014-07-03 00:31:30
阅读次数:
342
【题目】
Sort a linked list in O(n log n) time using constant space complexity.
【题意】
排序一个链表,要求时间复杂度O(nlogn),使用常量空间
【思路】
nlogn的复杂度,用归并排序求解...
分类:
其他好文 时间:
2014-07-02 09:25:40
阅读次数:
252
Sort a linked list in O(n log n)
time using constant space complexity.
看到O(n log n)的排序算法,适合单链表的首先想到的就是归并排序
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* Lis...
分类:
其他好文 时间:
2014-07-02 08:47:34
阅读次数:
239
【题目】
Sort a linked list using insertion sort.
【题意】
用插入排序方法排序链表
【思路】
直接搞...
分类:
其他好文 时间:
2014-07-02 08:33:49
阅读次数:
200
import java.io.*;import java.util.*;public class SortTest{ public static void main(String args[]) throws IOException, ClassNotFoundException { ...
分类:
编程语言 时间:
2014-07-01 18:03:24
阅读次数:
322
多重背包,本题不需要二分优化。相对简单点。因为重复数十分小,小于10;
而增加一个限制每种材料的高度做法,如果使用逆向填表,那么只需要从这个高度往小递归填表就可以了。
还有就是注意要排序,以限制高度为标准从小到大排序,否则答案错误的。
#include
#include
#include
using std::sort;
const int MAX_K = 401;
const in...
分类:
其他好文 时间:
2014-07-01 16:08:42
阅读次数:
213
Sort colors:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the...
分类:
其他好文 时间:
2014-07-01 12:57:43
阅读次数:
179
1.写一个shell脚本test.sh,重新启动tomcat[java]view plaincopy#!/bin/sh./etc/profilepid=`psaux|greptomcat|grep-vgrep|grep-vretomcat|awk'{print$2}'`echo$pidif[-n"$...
分类:
系统相关 时间:
2014-07-01 12:08:38
阅读次数:
304
Ø 读取文件的时间
#!/bin/bash
for file in `ls /root`
do
stat $file>1.txt
sed -n "7p" 1.txt>2.txt
usetime= awk -F ":" '{print $2}' 2.txt
echo "time="$file $usetime
done
Ø 读取文件的每行while...
分类:
其他好文 时间:
2014-07-01 06:49:51
阅读次数:
204
自动化格式分区方法----非交互---可用于脚本要先给用户一个提示,让他选择一个分区来格式化foriin`mount|grep“/dev/sdb”|awk’{print$1}’`dofuser–km$i;umount$idoneddif=/dev/zeroof=$PartDiskbs=512count=1sync;sleep3echo‘np1+20Mnp2+512Mnp3+128Mt382w’|fdisk/dev/s..
分类:
系统相关 时间:
2014-07-01 06:00:36
阅读次数:
359