思路:遍历每个li,病并把它们存放到数组中去,然后通过sort()方法进行排序 58 8 31
98 75
分类:
Web程序 时间:
2014-06-29 14:47:18
阅读次数:
237
最近写了一个shell脚本,用到了cp、time、cut、awk命令,把他们的使用方法给写下来:1.cp和mvcp命令:用来完成文件的复制,从源文件夹复制到目标文件夹。执行后源文件夹和目标文件夹均有源文件。mv
命令:用来移动文件。执行后,源文件夹中没有源文件。我经常用mv命令来重命名文件注意:cp...
分类:
系统相关 时间:
2014-06-29 14:03:19
阅读次数:
5085
Given an array withnobjects colored red, white
or blue, sort them so that objects of the same color are adjacent, with the
colors in the order red, wh...
分类:
其他好文 时间:
2014-06-04 20:49:33
阅读次数:
276
Given an array withnobjects colored red, white or
blue, sort them so that objects of the same color are adjacent, with the colors
in the order red, wh...
分类:
其他好文 时间:
2014-06-03 13:13:50
阅读次数:
537
最近在复习自己的linux笔记,看到cut和sort的时候突然想起一直遗忘做的一件事:给某文本文件去重。发现用这两条指令的组合可以很轻松的完成自己想做的工作。要处理的原文本文件一条数据的格式是:str1
# str2 #str3,每行一条这种格式的数据。我需要的只是str2去重后的数据,所以可以这么...
分类:
其他好文 时间:
2014-05-30 20:18:52
阅读次数:
410
Sort a linked list inO(nlogn) time using
constant space complexity./** * Definition for singly-linked list. * struct
ListNode { * int val; * L...
分类:
其他好文 时间:
2014-05-30 15:17:18
阅读次数:
312
1、归并排序 2、内排序和外排序 外排序的一个例子是外归并排序(External merge
sort),它读入一些能放在内存内的数据量,在内存中排序后输出为一个顺串(即是内部数据有序的临时文件),处理完所有的数据后再进行归并。比如,要对 900 MB
的数据进行排序,但机器上只有 100 MB 的...
分类:
其他好文 时间:
2014-05-30 00:13:46
阅读次数:
257
希尔排序一。个人理解希尔排序(Shell
Sort)是插入排序的一种。是针对直接插入排序算法的改进。该方法又称缩小增量排序,因DL.Shell于1959年提出而得名。其实,希尔排序本质也就是直接插入算法的升级,希尔的基本思想,就是先将整个待排元素序列分割成若干个子序列(由相隔某个“增量”的元素组成的...
分类:
其他好文 时间:
2014-05-29 21:49:30
阅读次数:
516
class Solution {public: vector > ret; vector
subret;public: vector > fourSum(vector &num, int target) {
sort(num.begin(),num.end()); ...
分类:
其他好文 时间:
2014-05-29 09:31:13
阅读次数:
288
本篇文章介绍下redis排序命令.redis支持对list,set和sorted
set元素的排序。排序命令是sort 完整的命令格式如下:SORT key [BY pattern] [LIMIT start count] [GET
pattern] [ASC|DESC] [ALPHA] [STOR...
分类:
其他好文 时间:
2014-05-29 09:02:28
阅读次数:
318