05 2012 档案

线性表
摘要:抽象数据类型LinearList { //实例 0或多个元素的有序集合 //操作 Create (): 创建一个空线性表 Destroy (): 删除表 IsEmpty(): 如果表为空则返回t r u e,否则返回false Length (): 返回... 阅读全文
posted @ 2012-05-29 22:03 Buttonwood 阅读(219) 评论(0) 推荐(0)
C plus 内存管理
摘要:int *y = new int; *y = 10; 或者 int *y = new int (10); 或者 int *y; y = new int (10); 一维数组: float *x = new float [n]; 在Borland C++中,当new 不能分配足够的空间时,它会引发(t h r o w)一个异常xalloc (在except.h 中定义)。可以采用try - ca... 阅读全文
posted @ 2012-05-25 21:28 Buttonwood 阅读(171) 评论(0) 推荐(0)
C plus 笔记(一 )
摘要:传值函数:int Abc(int a, int b, int c){ return a+b+b*c+(a+b-c)/(a+b)+4;}模板函数:template<class T> T Abc(T a, T b, T c){ return a+b+b*c+(a+b-c)/(a+b)+4;}形式参数的用法会增加程序的运行开销类型T 的复制构造函数把相应的实际参数分别复制到形式参数a,b和... 阅读全文
posted @ 2012-05-25 20:47 Buttonwood 阅读(152) 评论(0) 推荐(0)
R/SAS/Matab数据相互转换
摘要:SAS与R语言的数据加载与转化 第一:R加载/调用SAS--在SAS中生成传送文件 LIBNAME SAS_R xport 'C:\sea.xpt';DATA SAS_R.sea;SET custdet1;RUN;--在R中读入library(foreign)library(Hmisc)sea<-sasxport.get("c:/sea.xpt")head(mydata)第二:SAS调用R的数据... 阅读全文
posted @ 2012-05-21 22:25 Buttonwood 阅读(756) 评论(0) 推荐(0)
awk 简单用法小结
摘要:1a. choose rows where column 3 is larger than column 5:awk '$3>$5' input.txt > output.txt1b. calculate the sum of column 2 and 3 and put it at the end of a row:awk '{print $0,$2+$3}' input.txtor replace the first column:awk '{$1=$2+$3;print}' input.txt2. show rows betwe 阅读全文
posted @ 2012-05-21 20:57 Buttonwood 阅读(273) 评论(0) 推荐(0)
Xargs 批量处理命令
摘要:xargs是实现批量处理最方便的方法,掌握xargs能省下写许多不必要的脚本。下面已几个例子说明(某些只适用于GNU xargs):删除所有.txt文件,可以在子目录下:find . -name "*.txt" | xargs rm打包一个目录下所有.pl文件,可在深层子目录:find . -name "*.pl" | xargs tar -zcf perl.tar.gz提交一个文件所包含的所有命令(一个命令一行):cat myfile.sh | xargs -i echo qsub {} | shkill所有满足某个匹配的进程:ps -ax | awk 阅读全文
posted @ 2012-05-21 20:47 Buttonwood 阅读(1077) 评论(0) 推荐(0)