快速排序:
#include
using namespace std;
template
void QuickSort(T *A,const int left,const int right)
{
if(lefttemp);
if(i
归并排序
#include
using namespace std;
template
void Merge(T *initList,T*mergedList,const int l,const int m,const int n)
{
int l1,l2,lResult;
for(l1=l,l2=m+1,lResult=l;l1<=m&&l2<=n;lResult++)
{
if(initList[l1]
void Mergepass(T *initList,T* resultList,const int n,const int s)
{ int i;
for(i=1;i
void MergeSort(T *a,int n)
{
T *b=new int[n+1];
for(int l=1;l