摘要:
1.冒泡排序:n*n。俩个for循环决定其时间复杂度为n^2template<classT>voidSwap(TA[],inti,intj){Ttmp=A[i];A[i]=A[j];A[j]=tmp;}//冒泡法bubblesorttemplate<classT>voidBubSort(TA[],intn){for(inti=0;i<n;++i){for(intj=i+1;j<n;++j){if(A[i]<A[j])Swap(A,i,j);}}}2.选择排序:n*n。同样,俩个for循环决定其时间复杂度为n^2。template<classT&g 阅读全文