sort函数:#include 默认从小到大,如果降序可写第三方函数进行排序,EXP:sort(array,array+n,cmp)①sort(数组首地址,首地址+排序个数)第一个参数是要排序的区间首地址,第二个参数是区间尾地址的下一地址。也就是说,排序的区间是[a,b)。简单来说,有一个数组int...
分类:
其他好文 时间:
2014-08-13 14:21:36
阅读次数:
199
在SHELL编程中,经常要处理一些字符串变量。比如,计算长度啊、截取子串啊、字符替换啊等等,常常要用到awk、expr、sed、tr等命令。下面给大家介绍个简单的字符串处理方法,用不着嵌套复杂的子命令。
${#VALUE}:计算VALUE字符串的字符数量。
${VALUE%.*}或${VALUE%%.*}:删除VALUE字符串中以分隔符“.”匹配的左边字符,保留右边字符。
${VAL...
分类:
其他好文 时间:
2014-08-13 13:04:46
阅读次数:
216
Tian Ji -- The Horse Racing
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 18155 Accepted Submission(s): 5281
Problem Description
...
分类:
其他好文 时间:
2014-08-13 10:37:05
阅读次数:
257
AWK用法
一、知识点一
1、域分割-F确定分割符如果不加-F默认以空格分割符
cat/etc/passwd|awk-F:‘{print$1,$2,$3}‘
2、抽取域
cat/etc/passwd|awk-F:‘{print$1}‘
3、$0代表全局域,也就是所有的记录
cat/etc/passwd|awk-F:‘{print$0}‘
4、单独打印记录
cat/etc/passwd|awk..
分类:
其他好文 时间:
2014-08-13 03:48:35
阅读次数:
177
之前Arrays 类中存在sort() 方法, 此方法可以直接对 对象数组进行排序。1.Comparable接口可以直接使用java.util.Arrays 类进行数组的排序操作,但对象所在的类必须实现Comparable 接口,用于指定排序接口。Comparable 接口定义如下:public i...
分类:
其他好文 时间:
2014-08-13 00:37:24
阅读次数:
263
题意:。。。
难点:如何判断是不是信息不全:在输入的时候建立并查集,之后判断有几个节点就可以了,剩下的就是kruskal算法。
代码:
#include
#include
#include
#define MAXN 105
#define INF 0x3f3f3f3f
using std::sort;
struct node{
int from;
int to;
int w;
}ed...
分类:
其他好文 时间:
2014-08-12 22:09:14
阅读次数:
257
Some time when you want to change the fasta seq into one lineFor awk: awk '/^>/&&NR>1{print "";}{ printf "%s",/^>/ ? $0" ":$0 }' YourFile > newfilenam...
分类:
系统相关 时间:
2014-08-12 21:18:04
阅读次数:
379
//快速排序思想:选择数组最后一个数(key),比它小的排他前面 ( key放中间 ) 比它大的排后面,
然后递归 终止条件(数组只有一个数)
public class Sort> { //能排序的都是能比较的,所以必须继承java.lang.Comparable
public void quick(T[] array){
sort(array,0,array.length...
分类:
编程语言 时间:
2014-08-12 18:59:34
阅读次数:
181
Insertion Sort is a simple sorting technique which was covered in previous challenges. Sometimes, arrays may be too large for us to wait around for in...
分类:
其他好文 时间:
2014-08-12 18:13:14
阅读次数:
404
#!/bin/bash
#description:Configrealserverloandapplynoarp
SNS_VIP=(
192.168.100.210
192.168.100.220
)
case"$1"in
start)
for((i=0;i<`echo${#SNS_VIP[*]}`;i++))
do
interface="lo:`echo${SNS_VIP[$i]}|awk-F.‘{print$4}‘`"
/sbin/ifconfig$interface${SNS_VIP[$i]}br..
分类:
其他好文 时间:
2014-08-12 17:37:45
阅读次数:
205