📜  c++ 归并排序 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:58.293000             🧑  作者: Mango

代码示例1
#include
using namespace std;
void merge(int a[],int low,int mid,int high)
{
    int b[10] ={0};
    int k=0;
    int i=low,j=mid+1;
    
    while(i<=mid&&j<=high)
    {
        if(a[i]<=a[j])
        {
            b[k++] = a[i];
            i++;
        }
        else{
            b[k++]= a[j];
            j++;
        }
    }
    while(i<=mid)
    {
        b[k++] = a[i++];
    }
    while(j<=high)
    {
        b[k++] = a[j++];
        
    }
    int p= low;
    for(int l = 0;l