From 4022e5c95210631e4aceb08eaf9d9071aa5aefc4 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Tue, 15 Sep 2026 08:16:43 +0800 Subject: Set up a git repo --- tests/upload/merge_sort_xunhuan.sy | 88 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 tests/upload/merge_sort_xunhuan.sy (limited to 'tests/upload/merge_sort_xunhuan.sy') diff --git a/tests/upload/merge_sort_xunhuan.sy b/tests/upload/merge_sort_xunhuan.sy new file mode 100644 index 0000000..55529ec --- /dev/null +++ b/tests/upload/merge_sort_xunhuan.sy @@ -0,0 +1,88 @@ +int a[1000]; + +/* L = 左边起始位置, R = 右边起始位置, RightEnd = 右边终点位置*/ +void Merge(int a[],int tmpA[],int L,int R,int RightEnd) +{ + /* 将有序的A[L]~A[R-1]和A[R]~A[RightEnd]归并成一个有序序列 */ + int LeftEnd; + int tmp; + + LeftEnd=R-1;/* 左边终点位置 */ + tmp=L;/* 有序序列的起始位置 */ + + while(L<=LeftEnd&&R<=RightEnd){ + if(a[L]