From 7076cba1a1d2fcd180e6a26101e59f038885d27a Mon Sep 17 00:00:00 2001 From: p7pykrxiq <1902838026@qq.com> Date: Fri, 18 Feb 2022 13:08:41 +0800 Subject: [PATCH] =?UTF-8?q?Add=20=E4=BA=8C=E5=85=83=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 二元选择排序 | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 二元选择排序 diff --git a/二元选择排序 b/二元选择排序 new file mode 100644 index 0000000..3a6b223 --- /dev/null +++ b/二元选择排序 @@ -0,0 +1,31 @@ +//二元选择法排序 +#include +int main() +{ + int i,j,y,k,c,max,min,temp,a[]={5,2,1,4,3,6,9,7,8,0}; + int length=sizeof(a)/sizeof(a[0]); + for(i=0;ia[j]) + min=j; + } + k=a[max]; + y=a[min]; + a[min]=a[i]; + a[max]=a[length-1-i]; + a[i]=y; + a[length-1-i]=k; + } + for(i=0;i