Category : C Source Code
Archive   : CSORTS.ZIP
Filename : INT-SORT.C
This code was compiled with Power C v. 1.3 (medium memory) using the qisort
algorithm. On a 10Mhz 80286 the exe file sorted 25,000 random integers
in an average of 4.5 seconds.
*/
#include
#include
#include
#include
#include
#define MAX 25000
qisort(n,what);
int n, what[MAX];
main()
{
int seed, diffsecs, diffmils;
time_t timer;
struct timeb start, finish;
n = 0;
time(&timer);
seed = abs((timer - 678901234)/3);
printf("Seed = %d\n\n", seed);
printf("Creating array of %d random integers\n\n", MAX);
srand(seed);
for(n = 0; n < MAX; n++) what[n] = rand();
/* for(n = 0; n < MAX; n++) printf("%d\n", what[n]);*/
printf("Begin sort . . . \n\n");
ftime(&start);
qisort(n,what);
ftime(&finish);
printf("Start time was %ld.%3d\n", start.time, start.millitm);
printf("Finish time was %ld.%3d\n", finish.time, finish.millitm);
diffsecs = finish.time - start.time;
diffmils = finish.millitm - start.millitm;
if (diffmils < 0) {
diffsecs--;
diffmils += 1000;
}
printf("Total time was %d.%3d seconds\n\n", diffsecs, diffmils);
/* for(n = 0; n < MAX; n++) printf("%d\n", what[n]);*/
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/