1#include <stdio.h>2 3 int*insertion (int*array,intn);4 voidPrintf_array (int*array,intn);5 6 intMain ()7 {8 inta[Ten] = {101, -, the,Panax Notoginseng, About, $, -, the, the, One};9Insertion (A,Ten);Ten OnePrintf_array (A,Ten); A - } - the - int*insertion (int*array,intN) - { - inti; + intJ; - intkey; + for(i =1; I < n; i + +) A { atKey =Array[i]; -j = i-1; - while(J >=0) && (Array[j] >key)) - { -Array[j +1] =Array[j]; -J--; in } -array[j+1] =key; to } + returnArray; - } the * $ voidPrintf_array (int*array,intN)Panax Notoginseng { - inti =0; the for(i; i < n; i + +)) + { Aprintf"%d", Array[i]); the } +printf"\ n"); -}
Introduction to the third edition of the algorithm introduction of the first algorithm insert sort
C Language Implementation code
Insert sort is the basis of the foundation
According to the book,
Insert Sort algorithm