{ /* write the output from quicksort and put them */
k = list[i]; /*to a file */
fprintf(fp,"%d\n",k);
}
fclose(fp);
fp = fopen(any1,"r");
i = 0;
while(fscanf(fp,"%d\n",&k) != EOF)
{
list[i] = k;
i = i + 1;
}
fclose(fp);
cout << "\nSorting with Insertion Sort... waits" << '\n';
start = clock();
insertion(0,max); /* sort an unsorted list with insertion sort */
end=clock();
result = (end-start)/CLK_TCK;
cout << "The time needs to sort " << max
<< " numbers in Insertion is : " << result << " second(s)" << "\n\n";
cout << "Sort an already sorted array again with Quicksort..." << '\n';
min = 0;
max1 = max;
max1=max1-1;
start = clock();
quicksort(min,max1); /* sort an already sort list with quicksort */
end=clock();
result = (end-start)/CLK_TCK;
cout << "The time needs to sort " << max
<< " numbers in Quicksort is : " << result << " second(s)" << "\n";
cout << "Sort an already sorted array again with Insertion sort..." << '\n';
start = clock();
insertion(0,max); /* sort an already list with insertion sort */
end=clock();
result = (end-start)/CLK_TCK;
cout << "The time needs to sort " << max
<< " numbers in Insertion sort is : " << result << " second(s)" << '\n';
}