快速排序 C语言实现
快速排序(假设我们要排成升序)的思想是:取第一个值为中间值,然后遍历(虽然是从数组两边同时遍历,但是时间复杂度依旧是O(n)),把比中间值小的放在中间值左边,把比中间值大的放在中间值右边。然后两边继续刚才的循环,其实也就是递归。#include <stdlib.h>#include <stdio.h>#include <malloc.h>void sort_(int *,int,int);//排序 int findpos(int*,int,int
原创
2022-02-25 16:42:23 ·
555 阅读 ·
0 评论