//计数排序voidCountSort(int* arr,int sz){int max = arr[0], min = arr[0];//默认为首元素//找最大、最小数for(int i =0; i < sz; i++){if(arr[i]> max){max = arr[i];}if(arr[i]< min){min = arr[i];}}//计数int range = max - min +1;//count数组大小//calloc申请内存会自动将所有元素默认设置为0int* count =(int*)calloc(range,sizeof(int));if(count ==NULL){perror("malloc fail!\n");exit(1);}for(int i =0; i < sz; i++){count[arr[i]-min]++;//对应的count数组元素++}//排序int index =0;//arr数组下标//遍历count数组,找对应元素出现的次数for(int i =0; i < range; i++){//将count数组对应元素放入arr数组while(count[i]--){arr[index++]= i + min;}}//释放内存free(count);count =NULL;}
pip install tkinter:ERROR: Could not find a version that satisfies the requirement tkinter
这是因为,安装python的时候没有安装tkinter选项,解决这个问题有下面两种方法
一、重新安装python
但是这个步骤有点麻烦
二、在python-3.1…
文章目录 1、XGBoost Algorithm2、Comparison of algorithm implementation between Python code and Sentosa_DSML community edition(1) Data reading and statistical analysis(2)Data preprocessing(3)Model Training and Evaluation(4)Model visualization 3、summarize 1…