摘要: #include #include #include using namespace std;int BinSearch(vector ivec, int key) //循环实现的二分查找要比递归实现效率要高很多,推荐使用这种方法{ int low = 0, high = ivec.siz... 阅读全文
posted @ 2014-09-17 23:52 tilly_chang 阅读(307) 评论(0) 推荐(0) 编辑
摘要: C语言可以采用函数名作为唯一标示。C++中函数的唯一标示是,函数签名(signature),不仅包括函数的名字,还包括参数列表等。但是不包括函数返回值。C++对函数名进行名字改编 (name mangling) : nm -A详情请参考 C++ 第七章 阅读全文
posted @ 2014-09-17 19:37 tilly_chang 阅读(147) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; inline void swap(int *a, int *b){ //内联函数有一下几个优点: int temp = *a; //可以看做更高级的宏函数 ... 阅读全文
posted @ 2014-09-17 16:32 tilly_chang 阅读(234) 评论(0) 推荐(0) 编辑