随笔分类 - 数据结构与算法
摘要:1 // 2 #include 3 //没有排序的数据:只能顺序查找 4 using namespace std; 5 /* 6 a为数组 7 n为数组大小 8 x为要查找的数 9 */ 10 int SquentialSearch(int *a,const int n,const int x); 11 12 int main() 13 { 14 int m[]={2,4,...
阅读全文
摘要:C/C++中交换算法的几种方式 1 #include 2 #include 3 4 using namespace std; 5 //第二种方法,定义一个函数 6 void swap(int x,int y); 7 //第三种方法, 8 void swap1(int *px,int *py); 9 //第四种方法,宏定义 10 #define SWAP2(x,y,t) ((t)...
阅读全文

浙公网安备 33010602011771号