自下而上合併排序算法

歸併排序算法 時間複雜度: O(nlogn) 穩定性: 穩定排序算法 算法 void Merge(short A[],int p,int q,int r)//合併 { short *B=new short[r-p+1]; int s=p,t=q+1,k=0; while ( (s<=q) && (t<=r) ) { if(A[s]<=A[t]) B[k++]=A[s++]
相關文章
相關標籤/搜索