摘要:
#include <stdio.h>#include <stdlib.h>#include <string.h>template <class T>voidcountSort(T* array, int len){ T max = array[0]; T min = array[0]; for(int i =0 ;i<len; ++i){ if(array[i]>=max) max = array[i]; if(array[i]<min) min = array[i]; } T* countArray = (T*)calloc( 阅读全文
摘要:
#include <stdio.h>#include <stdlib.h>#include <string.h>template <class T>voidinsert(T* array, int pos){ int i = pos-1; T value = array[pos]; while(i>=0 && array[i]>value){ --i; } memmove((array+i+2), (array+i+1), sizeof(T)*(pos-i-1)); array[i+1] = value;}intmai 阅读全文