摘要: windows:Calculates the wall-clock time used by the calling process. return:The elapsed wall-clock time since the start of the processLinux:The clock() function returns an approximation of processor time used by the program Windows: 1 #include 2 #include 3 #include 4 5 int main() 6 { 7 printf... 阅读全文
posted @ 2013-12-22 23:14 good90 阅读(627) 评论(0) 推荐(0) 编辑
摘要: 快速排序使用分治法(Divide and conquer)策略来把一个串行(list)分为两个子串行(sub-lists)。步骤为:从数列中挑出一个元素,称为 "基准"(pivot),重新排序数列,所有元素比基准值小的摆放在基准前面,所有元素比基准值大的摆在基准的后面(相同的数可以到任一边)。在这个分区退出之后,该基准就处于数列的中间位置。这个称为分区(partition)操作。递归地(recursive)把小于基准值元素的子数列和大于基准值元素的子数列排序。伪码:排序1 QuickSort(A, p, r)2 if p A[j]8 exchange A[i + 1] A[ 阅读全文
posted @ 2013-12-22 20:29 good90 阅读(365) 评论(0) 推荐(0) 编辑
摘要: 1、打开我的博客->管理,点击文件选项,上传pdf文件,记下对应的链接2、在写随笔时选择编辑Html源代码:加上这一行:即可。 阅读全文
posted @ 2013-12-15 16:33 good90 阅读(832) 评论(2) 推荐(1) 编辑
摘要: 来自于:http://www.imada.sdu.dk/~rolf/Edu/DM22/F06/haskell-operatorer.pdf 阅读全文
posted @ 2013-12-15 16:22 good90 阅读(470) 评论(0) 推荐(0) 编辑
摘要: Haskell基础语法Real World Haskell 中文版Haskell趣学指南 阅读全文
posted @ 2013-12-14 16:53 good90 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 简单例子如下:#include "Ice/Ice.h"#include "IceUtil/IceUtil.h"#include "Printer.h"using namespace std;using namespace Hello;class MyClass;typedef IceUtil::Handle MyClassPtr;class MyClass : public IceUtil::Shared{public: MyClass( int i) : _i(i){ { ... 阅读全文
posted @ 2013-10-18 00:30 good90 阅读(1055) 评论(0) 推荐(0) 编辑
摘要: 在linux下使用动态库时,经常会发现明明编译时指定的是libA.so,可是程序运行时或通过ldd查看依赖却是libA.so.XXX,原因跟linux下so库的soname有关,查看so库的soname可以通过命令:readelf -d libXXX.so看到;具体使用见下面的例子。编译命令:g++ -fPIC -shared -Wl,-soname,libhello.so.1 -o libhello.so.1.1 hello.cppreadelf -d libhello.so.1.1g++ test.cpp -L. libhello.so.1.1 -o test 阅读全文
posted @ 2013-10-18 00:17 good90 阅读(2150) 评论(0) 推荐(0) 编辑
摘要: 记录下:Linux下导出so库接口时在下面情况下无法导出(编译时增加了__attribute__(("hidden"))属性)。void *__attribute__(("default")) test()这样该编译出的so库中test函数还是Local属性的,必须这样声明__attribute__(("default"))void * test()才可以导出GLOBAL属性的。参考:http://seekingfun.org/blog/2010/08/09/gcc-visibility/ 阅读全文
posted @ 2013-10-18 00:07 good90 阅读(612) 评论(0) 推荐(0) 编辑
摘要: delete void pointer是否会有内存泄漏?看下面一个简单例子class Test{public: Test(){ printf ("constructor\n"); } ~Test(){ printf("destructor"); }};int main(int argc, char *argv[]){ Test *p = new Test(); void *p1 = p; delete p1; printf("the end\n"); getchar(); return 0;} 结果输出:从输出可以看出来,没有调用类的 阅读全文
posted @ 2013-10-17 23:30 good90 阅读(409) 评论(0) 推荐(0) 编辑
摘要: 普通计时可以clock()精确计时:windows:QueryPerformanceCounter() linux:clock_gettime()用法:google参考:http://blog.csdn.net/pirate_code/article/details/5670055http://blog.chinaunix.net/uid-25909722-id-2827364.html 阅读全文
posted @ 2013-07-28 21:24 good90 阅读(184) 评论(0) 推荐(0) 编辑