//插入排序:package org.rut.util.algorithm.support;import org.rut.util.algorithm.SortUtil;/*** @author treeroot* @since 2006-2-2* @version 1.0*/public clas...
分类:
编程语言 时间:
2014-07-24 00:53:17
阅读次数:
504
可以用下面的命令将 cpu 占用率高的线程找出来:ps H -eo user,pid,ppid,tid,time,%cpu,cmd --sort=%cpu这个命令首先指定参数'H',显示线程相关的信息,格式输出中包含:user,pid,ppid,tid,time,%cpu,cmd,然后再用%cpu字...
分类:
编程语言 时间:
2014-07-23 20:46:15
阅读次数:
529
1.接口实现及类型转换 1 type Sequence []int 2 3 // Methods required by sort.Interface. 4 func (s Sequence) Len() int { 5 return len(s) 6 } 7 func (s Sequen...
分类:
其他好文 时间:
2014-07-23 16:43:41
阅读次数:
210
sort函数在使用中非常好用,也非常简单,而且效率与冒泡或者选择排序不是一个数量级。本文就sort函数在vector中的用法分为sort函数入门用法与自定义comp比较函数比较结构体这两个最基本的功能讲讲其用法:1、sort入门:使用sort需要包含algorithm头文件,完整代码如下#inclu...
分类:
其他好文 时间:
2014-07-23 16:28:11
阅读次数:
202
我们可以把它直接考虑是个一维数组,对每个点向两边扩展,记录数据在数组中,
就是DFS
#include
int a[81],left,right;
void sort(int num,int pos)
{int x,y;
if (num!=-1)
{if (posright) right=pos;
a[pos]+=num;
s...
分类:
其他好文 时间:
2014-07-22 23:53:17
阅读次数:
266
Commands available in csamtools are available as simple function calls. For example:pysam.sort( "ex1.bam", "output" )corresponds to the command line:s...
分类:
编程语言 时间:
2014-07-22 22:47:12
阅读次数:
243
shuffle是处在map和reduce之间的过程。我们看一下这个过程都有哪些步骤,对这个问题了解的并不深,可能有错误,忘指正
1. map
map输出key,value,对应代码里的context.write(key, value);,这个步骤是将key,value写到内存buffer里了,这个内存的默认大小是100M
2. sort
当数据大小超过buffer容量的80%(默认)时,会...
分类:
其他好文 时间:
2014-07-22 22:39:53
阅读次数:
295
最近在优化hiveSQL,
下面是一段排序,分组后取每组第一行记录的SQL
INSERT OVERWRITE TABLE t_wa_funnel_distinct_temp PARTITION (pt='${SRCTIME}')
SELECT
bussiness_id,
cookie_id,
session_id,
funnel_...
分类:
数据库 时间:
2014-07-22 17:42:31
阅读次数:
344
==========================================第一种(普通排序)string[]s={"zhangsan","lisi","wangwu","liumazi"};
Array.Sort(s);//排序
foreach(stringitemins)
{
Console.WriteLine(item);
}==========================================第二种(自定义类排序)-----------..
分类:
其他好文 时间:
2014-07-22 14:57:14
阅读次数:
300
题意:
给定n个数字。
问任意两数之间的差的总和是多少。
思路:
先从小到大排序。
然后dp转移方程:
sum[i]=sum[i-1] + i*(sum[i]-sum[i-1]);
最后结果是ans=sum[n]*2;(因为噪声计算是双向的)
其实与其说是dp,还不如说是找规律。
这样的时间复杂度是sort的时间复杂度O(nlogn)。
主要卡精度。。。。
法一:#i...
分类:
其他好文 时间:
2014-07-22 14:20:04
阅读次数:
174