#include <stdio.h> #define N 1000 int arr[N]; /* For a length of n Array of arr Perform insert sort */ void
insertionSort(int arr[], int n); /* Print length is n Array of arr */ void printArray(int arr[],
int n); int main() { int n, i; scanf("%d", &n); for (i = 0; i < n; ++i) { scanf(
"%d", &arr[i]); } insertionSort(arr, n); printArray(arr, n); return 0; } /*
Print length is n Array of arr */ void printArray(int arr[], int n) { int i; for (i = 0; i < n; i
++) { printf("%d", arr[i]); if (i < n - 1) /* subscript 0..n-2 There is a space after each element */ printf(" ");
/* subscript n-1, That is, there is no space after the last element */ } printf("\n");/* Wrap a line after printing */ } void insertionSort(int
arr[], int n){ int tmp; for(int i=1; i<n; i++) { int tmp = arr[i]; for(int j=i-
1; j>=0; j--) { if(tmp<arr[j]) { int temp; temp = arr[j]; arr[j] = arr[j+1]; arr
[j+1] = temp; } } } }

Technology
©2020 ioDraw All rights reserved
PHP call shell command Notes on core principles of reverse engineering ( One )——Hello World-1Python Student information management system ( Lite ) Sharing a script of hacker empire code rain , Simple and fun ! Ctrip 2019 School recruitment LRU Cache Advanced programmer - Deep understanding of data structure python calculation macd Methods mac solve Enter passphrase for key Enter the password each time Beginner's GuideWeekly planning mind map template