![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法回顾
双之城
额外去惹人王企鹅
展开
-
const 应用
const int bufSize = 512; const对象必须初始化 const对象一旦创建后其值就不能再改变。 cosnt int ci = 1024; const int &r = ci; 对常量的引用不能被用作修改它所绑定的对象 int &r1 = ci;//错误:一个非常量应用不能指向一个常量对象 const double pi = 3.14; const double &cpt原创 2017-04-08 10:00:21 · 299 阅读 · 0 评论 -
strcat()的实现
char *strcat(char *stra,const char *strb){ char *p = stra; while(*p) p++; while(*p++ = *strb++); }原创 2017-04-08 10:55:37 · 322 阅读 · 0 评论 -
归并排序
const int MaxSize = 100; void Merge(int *arr, int low, int mid, int high){//合并 if(low < high){ int arrC[MaxSize]; for(int k = low;k <= high;k++) arrC[k] = arr[k]; cout <<原创 2017-04-08 11:30:09 · 212 阅读 · 0 评论 -
大数乘法
void Reverse(string &str){ int Size = str.size(); int i = 0; int j = Size - 1; while(i < j){ char temp = str[i]; str[i++] = str[j]; str[j--] = temp; } } st原创 2017-04-09 12:57:24 · 257 阅读 · 0 评论 -
最大/最小堆排序
void swap(int *arr, int a, int b){//交互两个数的位置 int temp = arr[a]; arr[a] = arr[b]; arr[b] = temp; } void BuildMaxHeap(int *arr, int i, int n){//建立大顶堆,进行调整 int parent = arr[i], j; fo原创 2017-04-11 11:40:48 · 321 阅读 · 0 评论