二分查找和快速排序

#include 
void output(int *arr,int n)
{
    for(int i=0;ikey)
        {
            high=mid-1;
        }
        else if(arr[mid]==key)
        {
            printf("mid=%d\n",mid);
            return;
        }
    }
    puts("half_sort error");
    return;
}
int fun(int *arr,int low,int high)
{
    int key=arr[low];
    while(low=arr[low])
        {
            low++;
        }
        arr[high]=arr[low];
    }
    arr[low]=key;
    return low;
}
void fast_sort(int *arr,int low,int high)
{
    if(low>=high)
    {
        return;
    }
    int mid= fun(arr,low,high);
    fast_sort(arr,low,mid-1);
    fast_sort(arr,mid+1,high);
}
int main() {
    int n;
    printf("please input n:");
    scanf("%d",&n);
    int arr[n];
    for(int i=0;i

你可能感兴趣的:(算法,数据结构,排序算法)