标签:插入 include clu tty amp rac for printf code
1 #include <stdio.h> 2 3 typedef int ElementType; 4 5 void InsertionSort(ElementType *Array,int ArrayLen) 6 { 7 int i,j; 8 ElementType ExtractElem; 9 for(i = 1;i < ArrayLen;i ++) 10 { 11 ExtractElem = Array[i]; 12 for(j = i - 1;j >= 0 && ExtractElem < Array[j];j --) 13 { 14 Array[j+1] = Array[j]; 15 } 16 //Insert 17 Array[j+1] = ExtractElem; 18 } 19 } 20 21 int main() 22 { 23 ElementType TestArray[10] = {8,9,2,4,1,2,5,9,3,7}; 24 InsertionSort(TestArray,10); 25 int i; 26 for(i = 0;i < 10;i ++) 27 { 28 printf("%d ",TestArray[i]); 29 } 30 printf("\n"); 31 return 0; 32 }
标签:插入 include clu tty amp rac for printf code
原文地址:https://www.cnblogs.com/Asurudo/p/9427439.html