随笔分类 - c++
摘要:#include #include using namespace std; class BigNumberMutiplication{ private: char *num1; char *num2; char *result; int lenNum1; int lenNum2; void reverseNumerbs(); void...
阅读全文
摘要:#includeint merge(int unsortedarr[],int lb,int rb,int len,int sortedarr[]){ int i=lb,j=rb,k=0; while(i<rb&&j<=len) { if(unsortedarr[i]...
阅读全文
摘要:#include#includeusing namespace std;int heapAdjust(int array[],int top,int depth){ int rc=array[top]; for(int i=top*2;iarray[i]) ...
阅读全文
摘要:#include using namespace std;void print(int a[],int len){ for(int i=0;i=h) return; int m=(h+l)/2; mergeSort(a,l,m); mergeSort(a,m+1...
阅读全文
摘要:队列实现广度优先遍历#include #include using namespace std;int visit[5]={0};typedef struct { char vexs[5]; int AdjMatrix[5][5]; int vexnum;...
阅读全文
摘要:利用递归实现深度优先遍历图 1 #include 2 using namespace std; 3 int visit[5]={0}; 4 5 typedef struct { 6 char vexs[5]; 7 int AdjMatrix[5][5]; 8 ...
阅读全文
摘要:1.快速排序的思想:通过一趟排序将要排序的数据分割成独立的两部分,其中一部分的所有数据都比另外一部分的所有数据都要小,然后再按此方法对这两部分数据分别进行快速排序,整个排序过程可以递归进行,以此达到整个数据变成有序序列。2.实现:首先写一个将数组分割成两块的函数int Partion(int arr...
阅读全文
摘要:#include#includeusing namespace std;int helpAdd(const char *a,const char *b,char * result){ int len_a=strlen (a); int len_b=strlen (b); in...
阅读全文

浙公网安备 33010602011771号