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/insert_sort.sy | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/upload/insert_sort.sy (limited to 'tests/upload/insert_sort.sy') diff --git a/tests/upload/insert_sort.sy b/tests/upload/insert_sort.sy new file mode 100644 index 0000000..277d6a7 --- /dev/null +++ b/tests/upload/insert_sort.sy @@ -0,0 +1,37 @@ +int a[1000]; + +/* 插入排序 */ +void InsertSort(int a[],int n) +{ + int p; + int i; + int tmp; + + p =1; + while(p=1&&a[i-1]>tmp){ + a[i]=a[i-1];/*依次与已排序序列中元素比较并右移*/ + i=i-1; + } + a[i]=tmp;/*放进合适的位置 */ + p=p+1; + } +} + +int main() +{ + int size; + int i; + size = getint(); + i = 0; + while(i