#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
Vue The difference between single page and multi page 0.96OLED display -4 Line SPI explain R In language Axis() Detailed explanation of function parameters JAVA Snake games ( Source code + notes )C++ vector Simulation Implementation of class javascript Adding and deleting form information CCF A series of questions --2016 year 4 Month 1 Calculation of break point postman Interface test get timestamp and MD5 encryption 【 Recommended benefits 】c++ use easyx Making pixel birds , Simple hands on games TCP/IP There are so many loopholes in the agreement ?