⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prepair.c

📁 此程序改自算法课的一个作业
💻 C
字号:
/*****************************************************Zhang Pengpeng (rocflyhi@gmail.com)   from Colleage of Information Science and Technology Nanjing University of Aeronautics and Astronautics Comment: This program comes form my algorithm homework which is modified for linux and GCC.*****************************************************/#include "sort.h"#include <stdio.h>#include <time.h>/********************Follow is preparation*********************/void getArr()		/*produce random array*/{	int i;	srand (time(NULL));	for(i=0;i<numArr;i++)		Arr[i]=rand();}void copyArr()	/*copy date to protect original date*/{	int i;	for(i=0;i<numArr;i++)		A[i]=Arr[i];}void statistics(int sortMode)/*get average sortMode is the sort method*/{	double sum=0;	int compCount;	for(compCount=0;compCount<numArr;compCount++)		sum+=compPerSort[sortMode][compCount];	countAver[sortMode]=sum/numArr;}void output()		/*print the result*/{	int sortMode;	printf("Now print the average times of comparison \neach sort_algorithm take to deal with %d random numbers\n",numArr);	printf("SELECTIONSORT,INSERTIONSORT, BOTTOMUPSORT,    MERGESORT,    QUICKSORT\n");	for(sortMode=0;sortMode<5;sortMode++)		printf("%13.2f,",countAver[sortMode]);	printf("\n");}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -