码迷,mamicode.com
首页 >  
搜索关键字:sort    ( 12890个结果
Linux sort uniq awk head 完成访问日志统计排序功能
我们开发时候经常会遇到统计一些访问日志,访问日志中的url是海量的,并且都是重复的。以url为例,统计url中出现频率次数前5的url,并按出现次数的降序排序,我们可以通过linux sort、uniq、awk、head命令来统计...
分类:编程语言   时间:2015-01-29 09:27:01    阅读次数:167
8.2 二种记数排序实现
#include #include #include // COUNTING-SORT(A, B, k) // let C[0...k] be a new array // for i = 0 to k // C[i] = 0 // for j = 1 to A.length // C[A[j]] ...
分类:编程语言   时间:2015-01-29 09:19:39    阅读次数:232
Perl中Schwartzian转换问题
Perl中著名的Schwartzian转换,其产生背景主要涉及到排序问题: 比如说,根据文件名以字母顺序排序,代码如下: use strict; use warnings; my @files = glob "*.xml"; #perl中文件操作符glob提供相当于shell中的通配符的功能 my @sorted_files = sort @files; #sort(),排序,默认是字母顺序排序 比如说,根据文件名长度排序,其代码如下: use strict; use warni...
分类:其他好文   时间:2015-01-29 00:10:22    阅读次数:179
URAL 1306 - Sequence Median 小内存求中位数
【题意】给出n(1~250000)个数(int以内),求中位数【题解】一开始直接sort,发现MLE,才发现内存限制1024k,那么就不能开int[250000]的数组了(4*250000=1,000,000大约就是1M内存)。后来发现可以使用长度为n/2+1的优先队列,即包含前一半的数以及中位数,...
分类:其他好文   时间:2015-01-28 23:55:11    阅读次数:217
直接插入排序
直接插入排序是一种简单的排序方法。其基本思想是,开始时将原序列的第一个元素看作一个有序序列。然后依次取出原序列第二个元素及其后面的元素,并将其插入到有序序列中合适的位置,这样经过n-1次插入后就完成排序了。 private static void sort(int[] x, int n){ int i,j,t; for(i = 1; i < n; i++){ //i表示插入次...
分类:编程语言   时间:2015-01-28 22:39:21    阅读次数:191
linux下scoket句柄查询
关于linux下scoket打开超过设置的参数,并且网站应用打开比较慢,和报错toomaryopenfiles错误时。首先查询当前服务器的句柄数量#lsof-n|awk‘{print$2}‘|sort|uniq-c|sort-nr|more前列是句柄数量后列是进程编号#ps-aef|grep7191查看进程编号对应的进程再增加openfile的数量使用u..
分类:系统相关   时间:2015-01-28 19:53:14    阅读次数:306
eclipse使用技巧3——优化调试代码
1、格式化:Ctrl+shift+F a) 设置格式化风格: i. 打开Windows->preferences-》java-》code style-》formatter,按需求编辑格式或新建格式 ii.  2、成员排序:source -》sort Members 3、整理导入:source-》organize import 4、代码重构: a) 打开refactor->Rename...
分类:系统相关   时间:2015-01-28 19:48:43    阅读次数:233
mac
cat oui.txt|sed -e :a -e '$!N;s/\n\s/=/;ta' -e 'P;D' | sed 's/(hex)\+/=/g' | awk -F '=' '{print $3 $2 $NF}' | sed 's/\s\+/ /g' | sort > allmac.txt; c....
分类:系统相关   时间:2015-01-28 19:15:38    阅读次数:186
常见算法
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Sort{public class Sort{////// 插入排序--稳定排序//////public stati...
分类:编程语言   时间:2015-01-28 17:15:07    阅读次数:180
[C++]LeetCode: 128 Largest Number (自定义比较函数排序)
题目: Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330. Note: The result...
分类:编程语言   时间:2015-01-28 13:08:57    阅读次数:245
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!